用于特征探索的 PCA
您将使用上一个练习中构建的 PCA 管道,直观探索一些分类特征与 poke_df 中方差的关系。
这些分类特征(Type 与 Legendary)位于单独的 DataFrame poke_cat_df 中。
所有相关包和类都已为您预加载(Pipeline()、StandardScaler()、PCA())。
本练习是课程的一部分
Python 中的降维
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Build the pipeline
pipe = Pipeline([('scaler', StandardScaler()),
('reducer', PCA(n_components=2))])
# Fit the pipeline to poke_df and transform the data
pc = ____
print(pc)