public double cost() {
        return cost;
    }
@Test
    public void test() throws Exception {
        System.out.println("tSNE");

        MathEx.setSeed(19650218); // to get repeatable results.
        PCA pca = PCA.fit(MNIST.x).getProjection(50);
        double[][] X = pca.apply(MNIST.x);

        long start = System.currentTimeMillis();
        TSNE tsne = new TSNE(X, 2, 20, 200, 550);
        long end = System.currentTimeMillis();
        System.out.format("t-SNE takes %.2f seconds\n", (end - start) / 1000.0);

        assertEquals(1.3872256, tsne.cost(), 0.1);
        /*
        double[] coord0    = {  2.6870328, 16.8175010};
        double[] coord100  = {-16.3270630,  3.6016438};
        double[] coord1000 = {-16.2529939, 26.8543395};
        double[] coord2000 = {-17.0491869,  4.8453648};
        assertArrayEquals(coord0,    tsne.coordinates[0], 1E-6);
        assertArrayEquals(coord100,  tsne.coordinates[100], 1E-6);
        assertArrayEquals(coord1000, tsne.coordinates[1000], 1E-6);
        assertArrayEquals(coord2000, tsne.coordinates[2000], 1E-6);
         */
    }