@Test(expected = Test.None.class) public void testUSPS() throws Exception { System.out.println("USPS"); MathEx.setSeed(19650218); KMeans kmeans = KMeans.fit(USPS.x, 200); EuclideanDistance distance = new EuclideanDistance(); RBF<double[]>[] neurons = RBF.of(kmeans.centroids, new GaussianRadialBasis(8.0), distance); RBFNetwork<double[]> model = RBFNetwork.fit(USPS.x, USPS.y, neurons); int[] prediction = Validation.test(model, USPS.testx); int error = Error.of(USPS.testy, prediction); System.out.println("RBF Network Error = " + error); assertEquals(142, error); model = RBFNetwork.fit(USPS.x, USPS.y, neurons, true); prediction = Validation.test(model, USPS.testx); error = Error.of(USPS.testy, prediction); System.out.println("Normalized RBF Network Error = " + error); assertEquals(143, error); java.nio.file.Path temp = smile.data.Serialize.write(model); smile.data.Serialize.read(temp); }
public static <T> RBFNetwork<T> fit(T[] x, int[] y, RBF<T>[] rbf) { return fit(x, y, rbf, false); }
RBFNetwork implements Classifier<T> { public static <T> RBFNetwork<T> fit(T[] x, int[] y, RBF<T>[] rbf) { return fit(x, y, rbf, false); } }
RBFNetwork implements Classifier<T> { public static <T> RBFNetwork<T> fit(T[] x, int[] y, RBF<T>[] rbf) { return fit(x, y, rbf, false); } RBFNetwork(int k, RBF<T>[] rbf, Matrix w, boolean normalized);  RBFNetwork(int k, RBF<T>[] rbf, Matrix w, boolean normalized, IntSet labels); }
RBFNetwork implements Classifier<T> { public static <T> RBFNetwork<T> fit(T[] x, int[] y, RBF<T>[] rbf) { return fit(x, y, rbf, false); } RBFNetwork(int k, RBF<T>[] rbf, Matrix w, boolean normalized);  RBFNetwork(int k, RBF<T>[] rbf, Matrix w, boolean normalized, IntSet labels); static RBFNetwork<T> fit(T[] x, int[] y, RBF<T>[] rbf); static RBFNetwork<T> fit(T[] x, int[] y, RBF<T>[] rbf, boolean normalized); boolean isNormalized(); @Override int predict(T x); }
RBFNetwork implements Classifier<T> { public static <T> RBFNetwork<T> fit(T[] x, int[] y, RBF<T>[] rbf) { return fit(x, y, rbf, false); } RBFNetwork(int k, RBF<T>[] rbf, Matrix w, boolean normalized);  RBFNetwork(int k, RBF<T>[] rbf, Matrix w, boolean normalized, IntSet labels); static RBFNetwork<T> fit(T[] x, int[] y, RBF<T>[] rbf); static RBFNetwork<T> fit(T[] x, int[] y, RBF<T>[] rbf, boolean normalized); boolean isNormalized(); @Override int predict(T x);  }