Skip to content

Instantly share code, notes, and snippets.

@patricoferris
Created August 5, 2018 08:32
Show Gist options
  • Save patricoferris/bd47eb274ca7262c2758028d4dcb7ad9 to your computer and use it in GitHub Desktop.
Save patricoferris/bd47eb274ca7262c2758028d4dcb7ad9 to your computer and use it in GitHub Desktop.
try:
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
tsne = TSNE(perplexity=30, n_components=2, verbose=1, init='pca', n_iter=500, method='exact')
plot_only = len(artist_lookup)
low_dim_embs = tsne.fit_transform(final_embeddings[:plot_only, :])
except ImportError as ex:
print('Please install sklearn, matplotlib, and scipy to show embeddings.')
print(ex)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment