2

I'm trying to visualise my sample data using tsne. The code seems working fine but I am not sure about the correctness of my output.

tsne = manifold.TSNE(n_components = 2, 
                     random_state = 0, 
                     verbose = 5,
                     learning_rate = 80,
                     n_iter = 5000,
                     perplexity = 30,
                     method = "barnes_hut",
                     n_iter_without_progress = 30
                    )

transformed_data = tsne.fit_transform(x_std)

Here's the output:

[t-SNE] Computing pairwise distances...
[t-SNE] Computing 91 nearest neighbors...
[t-SNE] Computed conditional probabilities for sample 264 / 264
[t-SNE] Mean sigma: 0.667425
[t-SNE] Iteration 25: error = 0.8046873, gradient norm = 0.0232980
[t-SNE] Iteration 50: error = 0.5615926, gradient norm = 0.0139973
[t-SNE] Iteration 75: error = 0.2540671, gradient norm = 0.0037830
[t-SNE] Iteration 100: error = 0.2289363, gradient norm = 0.0031010
[t-SNE] KL divergence after 100 iterations with early exaggeration: 0.228936
[t-SNE] Iteration 125: error = 0.1968820, gradient norm = 0.0022478
[t-SNE] Iteration 150: error = 0.1885508, gradient norm = 0.0020406
[t-SNE] Iteration 175: error = 0.1865089, gradient norm = 0.0019922
[t-SNE] Iteration 200: error = 0.1859080, gradient norm = 0.0019791
[t-SNE] Iteration 225: error = 0.1857601, gradient norm = 0.0019759
[t-SNE] Iteration 250: error = 0.1857159, gradient norm = 0.0019746
[t-SNE] Iteration 275: error = 0.1857016, gradient norm = 0.0019742
[t-SNE] Iteration 275: error difference 0.000000. Finished.
[t-SNE] Error after 275 iterations: 0.228936

At the last row, it showed

[t-SNE] Error after 275 iterations: 0.228936

The error rate is from the following row: "KL divergence after 100 iterations with early exaggeration: 0.228936". Few examples I read, the error on the last row of the output is the error from 2 rows above. Am I doing it right? What did I missed?

Another test using exact method:

tsne = manifold.TSNE(n_components = 2, 
                     random_state = 0, 
                     verbose = 5,
                     learning_rate = 400,
                     n_iter = 5000,
                     method = "exact",
                     n_iter_without_progress = 300
                    )

transformed_data = tsne.fit_transform(x_std)

[t-SNE] Computing pairwise distances...
[t-SNE] Computed conditional probabilities for sample 264 / 264
[t-SNE] Mean sigma: 0.664578
[t-SNE] Iteration 25: error = 11.4506483, gradient norm = 0.1406410
[t-SNE] Iteration 50: error = 10.7174697, gradient norm = 0.1269968
[t-SNE] Iteration 75: error = 9.6377087, gradient norm = 0.1345971
[t-SNE] Iteration 100: error = 10.1510068, gradient norm = 0.1162036
[t-SNE] KL divergence after 100 iterations with early exaggeration: 10.151007
[t-SNE] Iteration 125: error = 0.1209401, gradient norm = 0.0063856
[t-SNE] Iteration 150: error = 0.1382205, gradient norm = 0.0117275
[t-SNE] Iteration 175: error = 0.1742659, gradient norm = 0.0140484
[t-SNE] Iteration 200: error = 0.1890085, gradient norm = 0.0169387
[t-SNE] Iteration 225: error = 0.2339525, gradient norm = 0.0177822
[t-SNE] Iteration 250: error = 0.2745199, gradient norm = 0.0190015
[t-SNE] Iteration 275: error = 0.2632307, gradient norm = 0.0188159
[t-SNE] Iteration 300: error = 0.2681131, gradient norm = 0.0187263
[t-SNE] Iteration 325: error = 0.2545400, gradient norm = 0.0182611
[t-SNE] Iteration 350: error = 0.2416118, gradient norm = 0.0180197
[t-SNE] Iteration 375: error = 0.2669461, gradient norm = 0.0179070
[t-SNE] Iteration 400: error = 0.2663364, gradient norm = 0.0178478
[t-SNE] Iteration 425: error = 0.2627337, gradient norm = 0.0183916
[t-SNE] Iteration 450: error = 0.2687405, gradient norm = 0.0198420
[t-SNE] Iteration 450: did not make any progress during the last 300 episodes. Finished.
[t-SNE] Error after 450 iterations: 10.151007
Roy
  • 45
  • 7
  • It is related to this issue, https://github.com/scikit-learn/scikit-learn/issues/6507 I had it fixed manually following the comment. – Roy Mar 09 '17 at 02:10

0 Answers0