@Test(expected = Test.None.class) public void testLongley() throws Exception { System.out.println("longley"); LinearModel model = RidgeRegression.fit(Longley.formula, Longley.data, 0.1); System.out.println(model); assertEquals(-1.354007e+03, model.intercept(), 1E-3); assertEquals(5.457700e-02, model.coefficients()[0], 1E-7); assertEquals(1.198440e-02, model.coefficients()[1], 1E-7); assertEquals(1.261978e-02, model.coefficients()[2], 1E-7); assertEquals(-1.856041e-01, model.coefficients()[3], 1E-7); assertEquals(7.218054e-01, model.coefficients()[4], 1E-7); assertEquals(5.884884e-01, model.coefficients()[5], 1E-7); double[] prediction = LOOCV.regression(Longley.formula, Longley.data, (f, x) -> RidgeRegression.fit(f, x, 0.1)); double rmse = RMSE.of(Longley.y, prediction); System.out.println("LOOCV RMSE = " + rmse); assertEquals(1.7288188, rmse, 1E-7); java.nio.file.Path temp = smile.data.Serialize.write(model); smile.data.Serialize.read(temp); }
public static LinearModel fit(Formula formula, DataFrame data) { return fit(formula, data, new Properties()); }
RidgeRegression { public static LinearModel fit(Formula formula, DataFrame data) { return fit(formula, data, new Properties()); } }
RidgeRegression { public static LinearModel fit(Formula formula, DataFrame data) { return fit(formula, data, new Properties()); }  }
RidgeRegression { 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[] weights, double[] lambda, double[] beta0); }
RidgeRegression { 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[] weights, double[] lambda, double[] beta0);  }