April 2018
Beginner to intermediate
282 pages
6h 52m
English
You can also try t-SNE to visualize high-dimensional data. First, TSNE will be applied to the original data:
# TSNEfrom sklearn.manifold import TSNEtsne = TSNE(verbose=1, perplexity=40, n_iter=4000)tsne = tsne.fit_transform(df)
Output in the console is as follows:
[t-SNE] Computing 121 nearest neighbors...[t-SNE] Indexed 569 samples in 0.000s...[t-SNE] Computed neighbors for 569 samples in 0.010s...[t-SNE] Computed conditional probabilities for sample 569 / 569[t-SNE] Mean sigma: 33.679703[t-SNE] KL divergence after 250 iterations with early exaggeration: 48.886528[t-SNE] Error after 1600 iterations: 0.210506
Plotting the results is as follows:
plt.scatter(tsne[:, 0], tsne[:, 1], c=data.target, cmap="winter", edgecolor="None", ...