Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Jun 16, 2021
Embed
What would you like to do?
from sklearn.manifold import TSNE
import plotly.express as px
df = px.data.iris()
features = df.loc[:, :'petal_width']
tsne = TSNE(n_components=2, perplexity=20, random_state=1000)
projections = tsne.fit_transform(features)
fig = px.scatter(
projections, x=0, y=1,
color=df.species, labels={'color': 'species'}
)
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment