@Test(expected = Test.None.class) public void testUSPS() throws Exception { System.out.println("USPS"); KNN<double[]> model = KNN.fit(USPS.x, USPS.y); int[] prediction = Validation.test(model, USPS.testx); int error = Error.of(USPS.testy, prediction); System.out.println("Error = " + error); assertEquals(113, error); java.nio.file.Path temp = smile.data.Serialize.write(model); smile.data.Serialize.read(temp); }
public static <T> KNN<T> fit(T[] x, int[] y, Distance<T> distance) { return fit(x, y, 1, distance); }
KNN implements SoftClassifier<T> { public static <T> KNN<T> fit(T[] x, int[] y, Distance<T> distance) { return fit(x, y, 1, distance); } }
KNN implements SoftClassifier<T> { public static <T> KNN<T> fit(T[] x, int[] y, Distance<T> distance) { return fit(x, y, 1, distance); } KNN(KNNSearch<T, T> knn, int[] y, int k); }
KNN implements SoftClassifier<T> { public static <T> KNN<T> fit(T[] x, int[] y, Distance<T> distance) { return fit(x, y, 1, distance); } KNN(KNNSearch<T, T> knn, int[] y, int k); static KNN<T> fit(T[] x, int[] y, Distance<T> distance); static KNN<T> fit(T[] x, int[] y, int k, Distance<T> distance); static KNN<double[]> fit(double[][] x, int[] y); static KNN<double[]> fit(double[][] x, int[] y, int k); @Override int predict(T x); @Override int predict(T x, double[] posteriori); }
KNN implements SoftClassifier<T> { public static <T> KNN<T> fit(T[] x, int[] y, Distance<T> distance) { return fit(x, y, 1, distance); } KNN(KNNSearch<T, T> knn, int[] y, int k); static KNN<T> fit(T[] x, int[] y, Distance<T> distance); static KNN<T> fit(T[] x, int[] y, int k, Distance<T> distance); static KNN<double[]> fit(double[][] x, int[] y); static KNN<double[]> fit(double[][] x, int[] y, int k); @Override int predict(T x); @Override int predict(T x, double[] posteriori);  }