New update     I unerstood PCA components ensure we select variables responsible for high variance but I would like to know how to extractkey variables responsible only for high variance through PCA components....Ideally simple example would be great helpPrevious descriptionPriciple Component Analysis is used when high dimensional data is analysed. In order to understand the cluster regidity we use PCA.         Is that all we use PCA for or else someother reason for this.Can you share some code  to extract PCA...the code I have is as shown belowImplementing PCA for visualizing after Kmeans clustering`# Interpret 3 cluster solutionmodel3=KMeans(n_clusters=3)model3.fit(clus_train)clusassign=model3.predict(clus_train)plot clusters'''The new variables, called canonical variables, are ordered interms of the proportion of variance and the clustering variables that is accounted for by each of the canonical variables.  So the first canonicalvariable will count for the largest proportion of the variance. The second canonical variable will account for the next largest proportion of variance,and so on. Usually, the majority of the variancein the clustering variables will be accounted for by the firstcouple of canonical variables and those are the variables that we can plot.'''from sklearn.decomposition import PCApca_2 = PCA(2) # Selecting 2 componentsplot_columns = pca_2.fit_transform(clus_train)plt.scatter(x=plot_columns[:,0], y=plot_columns[:,1], c=model3.labels_,)'''Observations are more spread outindicating less correlation among the observations andhigher within cluster variance.'''plt.xlabel('Canonical variable 1')plt.ylabel('Canonical variable 2')plt.title('Scatterplot of Canonical Variables for 3 Clusters')plt.show()`
How PCA is different from SubSpace clustering ? how to extract variables responsible for PCA1 component?
clustering;visualization;pca
Reducing the dimensionality of a dataset with PCA does not only benefits humans trying to look at the data in a graspable number of dimensions. It is also useful for machine learning algorithms to be trained on a subset of dimensions. Both to reduce the complexity of the data and the computational cost of training such machine learning model.