public static LinearModel fit(Formula formula, DataFrame data, Properties params) {
        double lambda1 = Double.parseDouble(params.getProperty("smile.elastic_net.lambda1"));
        double lambda2 = Double.parseDouble(params.getProperty("smile.elastic_net.lambda2"));
        double tol = Double.parseDouble(params.getProperty("smile.elastic_net.tolerance", "1E-4"));
        int maxIter = Integer.parseInt(params.getProperty("smile.elastic_net.iterations", "1000"));
        return fit(formula, data, lambda1, lambda2, tol, maxIter);
    }
@Test
    public void testToy() {
        double[][] A = {
                {1, 0, 0, 0.5},
                {0, 1, 0.2, 0.3},
                {1, 0.5, 0.2, 0.3},
                {0, 0.1, 0, 0.2},
                {0, 0.1, 1, 0.2}
        };

        double[] y = {6, 5.2, 6.2, 5, 6};

        DataFrame df = DataFrame.of(A).merge(DoubleVector.of("y", y));
        RegressionValidation<LinearModel> result = RegressionValidation.of(Formula.lhs("y"), df, df,
                (formula, data) -> ElasticNet.fit(formula, data, 0.1, 0.001));

        System.out.println(result.model);
        System.out.println(result);

        assertEquals(5.0262, result.model.intercept(), 1E-4);
        double[] w = {0.9659, -2.9425E-5, 0.9550, 7.4383E-5};
        for (int i = 0; i < w.length; i++) {
            assertEquals(w[i], result.model.coefficients()[i], 1E-4);
        }
    }