@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)); Formula formula = Formula.lhs("y"); LinearModel model = LASSO.fit(formula, df, 0.1, 0.001, 500); System.out.println(model); double[] prediction = Validation.test(model, df); double rmse = RMSE.of(y, prediction); System.out.println("RMSE = " + rmse); assertEquals(5.0259443688265355, model.intercept(), 1E-7); double[] w = {0.9659945126777854, -3.7147706312985876E-4, 0.9553629503697613, 9.416740009376934E-4}; for (int i = 0; i < w.length; i++) { assertEquals(w[i], model.coefficients()[i], 1E-5); } }
public static LinearModel fit(Formula formula, DataFrame data) { return fit(formula, data, new Properties()); }
LASSO { public static LinearModel fit(Formula formula, DataFrame data) { return fit(formula, data, new Properties()); } }
LASSO { public static LinearModel fit(Formula formula, DataFrame data) { return fit(formula, data, new Properties()); }  }
LASSO { public static LinearModel fit(Formula formula, DataFrame data) { return fit(formula, data, new Properties()); }  static LinearModel fit(Formula formula, DataFrame data); static LinearModel fit(Formula formula, DataFrame data, Properties prop); static LinearModel fit(Formula formula, DataFrame data, double lambda); static LinearModel fit(Formula formula, DataFrame data, double lambda, double tol, int maxIter); }
LASSO { public static LinearModel fit(Formula formula, DataFrame data) { return fit(formula, data, new Properties()); }  static LinearModel fit(Formula formula, DataFrame data); static LinearModel fit(Formula formula, DataFrame data, Properties prop); static LinearModel fit(Formula formula, DataFrame data, double lambda); static LinearModel fit(Formula formula, DataFrame data, double lambda, double tol, int maxIter);  }