Reputation: 1257
when to pass variance as PCA(n_components=0.95)
and when to use PCA(n_components=2)
with pipeline having Standardscaler for standardizes the feature values.
Upvotes: 0
Views: 136
Reputation: 1257
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
)
Upvotes: 0