Skip to content

Instantly share code, notes, and snippets.

@Kornel
Created June 29, 2017 19:13
Show Gist options
  • Save Kornel/8875973bc448b8566cd0a124d2588446 to your computer and use it in GitHub Desktop.
Save Kornel/8875973bc448b8566cd0a124d2588446 to your computer and use it in GitHub Desktop.
scikit TSNE template for multiple perplexities / iterations
fig, ax = plt.subplots(nrows=2, ncols=3)
perplexity = [[2, 10, 20],
[30, 50, 100]]
iterations = [[1000, 1000, 1000],
[1000, 1000, 1000]]
for ri, row in enumerate(ax):
for ci, col in enumerate(row):
perp = perplexity[ri][ci]
tsne_model = TSNE(n_components=2, perplexity=perp, n_iter=1000, random_state=12345)
tsne_output = tsne_model.fit_transform(uv_converted)
col.scatter(tsne_output[:, 0], tsne_output[:, 1])
col.set_title("perplexity {}".format(perp))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment