Created
April 20, 2024 08:33
-
-
Save radamanthus/424a895fe34ce7703fdeac48824d3b47 to your computer and use it in GitHub Desktop.
Exploring tSNE
This file contains 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
import pandas | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.manifold import TSNE | |
from ucimlrepo import fetch_ucirepo | |
breast_cancer_wisconsin_diagnostic = fetch_ucirepo(id=17) | |
X = breast_cancer_wisconsin_diagnostic.data.features | |
y = breast_cancer_wisconsin_diagnostic.data.targets | |
for p in range(1,50): | |
tsne = TSNE(n_components = 2, perplexity = p, random_state = 0) | |
X_tsne = tsne.fit_transform(X) | |
plt.scatter(X_tsne[:,0], X_tsne[:,1], c=X_tsne[:,1]) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment