-1

My goal is to find out if I can manipulate and measure data from a PCA or t-SNE plot in Python. I want to know if there is a way I can find distances of points from a center of clusters.

I think there is a way but I'm not too sure.

Jerome Ariola
  • 135
  • 1
  • 11

1 Answers1

0

You don't specify so much but maybe this can help you:

Clustering techniques information: https://scikit-learn.org/stable/modules/clustering.html#clustering

Dimensionality reduction: https://scikit-learn.org/stable/modules/decomposition.html#decompositions

Maybe the following script helps you:

from sklearn.decomposition import PCA

    X= your_data_variables
    cluster = "your cluster technique"   
    cluster.fit(X)
    pca=PCA(n_components= 2)
    pca.fit(X)
    pca_data = pd.DataFrame(pca.transform(X))
    centers = pca.transform(cluster.cluster_centers_)

Now you have the clusters center and your data in two dimenssion and you can calculate the distance as you want.

Pablo Vilas
  • 546
  • 5
  • 13
  • Thank you for these resources. I apologize for being a bit vague but I want to write a program that returns pairwise distance[?] in real time comparing new data to a t-SNE or PCA data plot. Is this possible? – Jerome Ariola Feb 05 '20 at 11:26
  • I change my answer, maybe this helps you. – Pablo Vilas Feb 05 '20 at 12:09