Skip to content

Instantly share code, notes, and snippets.

@peakBreaker
Created July 7, 2019 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peakBreaker/d86a2b3da5786533a77dc690cee3dd68 to your computer and use it in GitHub Desktop.
Save peakBreaker/d86a2b3da5786533a77dc690cee3dd68 to your computer and use it in GitHub Desktop.
Running TSNE
# Import TSNE
from sklearn.manifold import TSNE
def run_tsne(samples):
# Create a TSNE instance: model
model = TSNE(learning_rate=200)
# Apply fit_transform to samples: tsne_features
tsne_features = model.fit_transform(samples)
# Select the 0th feature: xs
xs = tsne_features[:,0]
# Select the 1st feature: ys
ys = tsne_features[:,1]
# Scatter plot, coloring by variety_numbers
# plt.scatter(xs,ys,c=labels)
# plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment