Skip to content

Instantly share code, notes, and snippets.

@radamanthus
Created April 20, 2024 08:33
Show Gist options
  • Save radamanthus/424a895fe34ce7703fdeac48824d3b47 to your computer and use it in GitHub Desktop.
Save radamanthus/424a895fe34ce7703fdeac48824d3b47 to your computer and use it in GitHub Desktop.
Exploring tSNE
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