在执行PCA之后,我想用标准化数据绘制KMeans聚类。但是,我无法真正理解将要执行的步骤。有人可以在这方面指导我吗? 提前致谢。
from sklearn.decomposition import PCA
pca = PCA(n_components=2)
Demography_Data = pca.fit_transform(x)
principalDf = pd.DataFrame(data = Demography_Data
, columns = ['Demography_Data_1', 'Demography_Data_2'])
principalDf.index=df2[['Customer_Age']].index
finalDf = pd.concat([principalDf, df2[['Customer_Age']]], axis = 1)
%matplotlib inline
colors = ['r', 'g', 'b', 'y', 'c', 'm']
ax = finalDf.plot(kind='scatter', x='Demography_Data_1', y='Demography_Data_2', figsize=(10,8))