Skip to content

Instantly share code, notes, and snippets.

@andrea-dagostino
Created November 23, 2021 11:53
Show Gist options
  • Save andrea-dagostino/3a2761d90f5a4b3397224c848a181265 to your computer and use it in GitHub Desktop.
Save andrea-dagostino/3a2761d90f5a4b3397224c848a181265 to your computer and use it in GitHub Desktop.
posts/raggruppamento-testuale-con-tf-idf
from sklearn.decomposition import PCA
# inizializziamo la PCA con 2 componenti
pca = PCA(n_components=2, random_state=42)
# passiamo alla pca il nostro array X
pca_vecs = pca.fit_transform(X.toarray())
# salviamo le nostre due dimensioni in x0 e x1
x0 = pca_vecs[:, 0]
x1 = pca_vecs[:, 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment