Created
June 2, 2022 18:12
-
-
Save kusal1990/3e3624cb07826de5210cfb62fe6d0f16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.manifold import TSNE | |
tsne = TSNE(n_components=2, perplexity=30, learning_rate=200, random_state=42) | |
X_embedding = tsne.fit_transform(df_signal_train) | |
y = np.array(df_signal_train['target']) | |
tsne = np.hstack((X_embedding, y.reshape(-1,1))) | |
tsne_to_df = pd.DataFrame(data=tsne, columns=['Dimension_x','Dimension_y','Score']) | |
colors = {0:'red', 1:'blue', 2:'green'} | |
plt.scatter(tsne_to_df['Dimension_x'], tsne_to_df['Dimension_y'], c=tsne_to_df['Score'].apply(lambda x: colors[x])) | |
plt.show() | |
del(tsne) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ok