何时将方差作为
PCA(n_components=0.95)
传递,何时使用 PCA(n_components=2)
以及具有 Standardscaler 的管道来标准化特征值。
pipeline = make_pipeline(
StandardScaler(),
PCA(n_components=0.95) # Retain 95% of the variance
)
pipeline = make_pipeline(
StandardScaler(),
PCA(n_components=2) # Reduce to exactly 2 dimensions
)