@Test public void testCPU() { System.out.println("CPU"); MathEx.setSeed(19650218); LinearModel model = ElasticNet.fit(CPU.formula, CPU.data, 0.8, 0.2); System.out.println(model); double[] prediction = CrossValidation.regression(10, CPU.formula, CPU.data, (f, x) -> ElasticNet.fit(f, x, 0.8, 0.2)); double rmse = RMSE.of(CPU.y, prediction); System.out.println("10-CV RMSE = " + rmse); assertEquals(55.313225659429634, rmse, 1E-4); }
public static LinearModel fit(Formula formula, DataFrame data, Properties prop) { double lambda1 = Double.valueOf(prop.getProperty("smile.elastic.net.lambda1")); double lambda2 = Double.valueOf(prop.getProperty("smile.elastic.net.lambda2")); double tol = Double.valueOf(prop.getProperty("smile.elastic.net.tolerance", "1E-4")); int maxIter = Integer.valueOf(prop.getProperty("smile.elastic.net.max.iterations", "1000")); return fit(formula, data, lambda1, lambda2, tol, maxIter); }
ElasticNet { public static LinearModel fit(Formula formula, DataFrame data, Properties prop) { double lambda1 = Double.valueOf(prop.getProperty("smile.elastic.net.lambda1")); double lambda2 = Double.valueOf(prop.getProperty("smile.elastic.net.lambda2")); double tol = Double.valueOf(prop.getProperty("smile.elastic.net.tolerance", "1E-4")); int maxIter = Integer.valueOf(prop.getProperty("smile.elastic.net.max.iterations", "1000")); return fit(formula, data, lambda1, lambda2, tol, maxIter); } }
ElasticNet { public static LinearModel fit(Formula formula, DataFrame data, Properties prop) { double lambda1 = Double.valueOf(prop.getProperty("smile.elastic.net.lambda1")); double lambda2 = Double.valueOf(prop.getProperty("smile.elastic.net.lambda2")); double tol = Double.valueOf(prop.getProperty("smile.elastic.net.tolerance", "1E-4")); int maxIter = Integer.valueOf(prop.getProperty("smile.elastic.net.max.iterations", "1000")); return fit(formula, data, lambda1, lambda2, tol, maxIter); }  }
ElasticNet { public static LinearModel fit(Formula formula, DataFrame data, Properties prop) { double lambda1 = Double.valueOf(prop.getProperty("smile.elastic.net.lambda1")); double lambda2 = Double.valueOf(prop.getProperty("smile.elastic.net.lambda2")); double tol = Double.valueOf(prop.getProperty("smile.elastic.net.tolerance", "1E-4")); int maxIter = Integer.valueOf(prop.getProperty("smile.elastic.net.max.iterations", "1000")); return fit(formula, data, lambda1, lambda2, tol, maxIter); }  static LinearModel fit(Formula formula, DataFrame data, Properties prop); static LinearModel fit(Formula formula, DataFrame data, double lambda1, double lambda2); static LinearModel fit(Formula formula, DataFrame data, double lambda1, double lambda2, double tol, int maxIter); }
ElasticNet { public static LinearModel fit(Formula formula, DataFrame data, Properties prop) { double lambda1 = Double.valueOf(prop.getProperty("smile.elastic.net.lambda1")); double lambda2 = Double.valueOf(prop.getProperty("smile.elastic.net.lambda2")); double tol = Double.valueOf(prop.getProperty("smile.elastic.net.tolerance", "1E-4")); int maxIter = Integer.valueOf(prop.getProperty("smile.elastic.net.max.iterations", "1000")); return fit(formula, data, lambda1, lambda2, tol, maxIter); }  static LinearModel fit(Formula formula, DataFrame data, Properties prop); static LinearModel fit(Formula formula, DataFrame data, double lambda1, double lambda2); static LinearModel fit(Formula formula, DataFrame data, double lambda1, double lambda2, double tol, int maxIter);  }