@Test public void tesDiabetes() { System.out.println("Diabetes"); MathEx.setSeed(19650218); GaussianKernel kernel = new GaussianKernel(5.0); double[] prediction = CrossValidation.regression(10, Diabetes.x, Diabetes.y, (x, y) -> SVR.fit(x, y, kernel, 50, 1000, 1E-3)); double rmse = RMSE.of(Diabetes.y, prediction); System.out.println("Diabetes 10-CV RMSE = " + rmse); assertEquals(61.710080572519516, rmse, 1E-4); }
public static Regression<double[]> fit(double[][] x, double[] y, double eps, double C, double tol) { smile.base.svm.SVR<double[]> svr = new smile.base.svm.SVR<>(new LinearKernel(), eps, C, tol); KernelMachine<double[]> svm = svr.fit(x, y); return new Regression<double[]>() { LinearKernelMachine model = LinearKernelMachine.of(svm); @Override public double predict(double[] x) { return model.f(x); } }; }
SVR { public static Regression<double[]> fit(double[][] x, double[] y, double eps, double C, double tol) { smile.base.svm.SVR<double[]> svr = new smile.base.svm.SVR<>(new LinearKernel(), eps, C, tol); KernelMachine<double[]> svm = svr.fit(x, y); return new Regression<double[]>() { LinearKernelMachine model = LinearKernelMachine.of(svm); @Override public double predict(double[] x) { return model.f(x); } }; } }
SVR { public static Regression<double[]> fit(double[][] x, double[] y, double eps, double C, double tol) { smile.base.svm.SVR<double[]> svr = new smile.base.svm.SVR<>(new LinearKernel(), eps, C, tol); KernelMachine<double[]> svm = svr.fit(x, y); return new Regression<double[]>() { LinearKernelMachine model = LinearKernelMachine.of(svm); @Override public double predict(double[] x) { return model.f(x); } }; }  }
SVR { public static Regression<double[]> fit(double[][] x, double[] y, double eps, double C, double tol) { smile.base.svm.SVR<double[]> svr = new smile.base.svm.SVR<>(new LinearKernel(), eps, C, tol); KernelMachine<double[]> svm = svr.fit(x, y); return new Regression<double[]>() { LinearKernelMachine model = LinearKernelMachine.of(svm); @Override public double predict(double[] x) { return model.f(x); } }; }  static Regression<double[]> fit(double[][] x, double[] y, double eps, double C, double tol); static Regression<int[]> fit(int[][] x, double[] y, int p, double eps, double C, double tol); static Regression<SparseArray> fit(SparseArray[] x, double[] y, int p, double eps, double C, double tol); static KernelMachine<T> fit(T[] x, double[] y, MercerKernel<T> kernel, double eps, double C, double tol); }
SVR { public static Regression<double[]> fit(double[][] x, double[] y, double eps, double C, double tol) { smile.base.svm.SVR<double[]> svr = new smile.base.svm.SVR<>(new LinearKernel(), eps, C, tol); KernelMachine<double[]> svm = svr.fit(x, y); return new Regression<double[]>() { LinearKernelMachine model = LinearKernelMachine.of(svm); @Override public double predict(double[] x) { return model.f(x); } }; }  static Regression<double[]> fit(double[][] x, double[] y, double eps, double C, double tol); static Regression<int[]> fit(int[][] x, double[] y, int p, double eps, double C, double tol); static Regression<SparseArray> fit(SparseArray[] x, double[] y, int p, double eps, double C, double tol); static KernelMachine<T> fit(T[] x, double[] y, MercerKernel<T> kernel, double eps, double C, double tol);  }