Skip to content

Instantly share code, notes, and snippets.

@sthomp
Created February 17, 2016 03:34
Show Gist options
  • Save sthomp/54986190b1500e3ab9e9 to your computer and use it in GitHub Desktop.
Save sthomp/54986190b1500e3ab9e9 to your computer and use it in GitHub Desktop.
t-SNE plot
def plot_tsne(X_input_pool3, Y_input,n=10000):
indicies = np.random.permutation(X_input_pool3.shape[0])[0:n]
Y=tsne(X_input_pool3[indicies])
num_labels=Y_input[indicies]
labels=classes[num_labels]
df=pd.DataFrame(np.column_stack((Y,num_labels,labels)), columns=["x1","x2","y","y_label"])
sns.lmplot("x1","x2",data=df.convert_objects(convert_numeric=True),hue="y_label",fit_reg=False,legend=True,palette="Set1")
print 'done'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment