@Test public void testBreastCancer() { System.out.println("Breast Cancer"); MathEx.setSeed(19650218); int[] prediction = CrossValidation.classification(10, BreastCancer.x, BreastCancer.y, (x, y) -> KNN.fit(x, y, 3)); int error = Error.of(BreastCancer.y, prediction); System.out.println("Error = " + error); assertEquals(44, error); }
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);  }