I typically get PCA
loadings like this:
pca = PCA(n_components=2) X_t = pca.fit(X).transform(X) loadings = pca.components_
If I run PCA
using a scikit-learn
pipline ...
from sklearn.pipeline import Pipeline pipeline = Pipeline(steps=[ ('scaling',StandardScaler()), ('pca',PCA(n_components=2)) ]) X_t=pipeline.fit_transform(X)
... is it possible to get the loadings?
Simply trying loadings = pipeline.components_
fails:
AttributeError: 'Pipeline' object has no attribute 'components_'
Thanks!
(Also interested in extracting attributes like coef_
from learning pipelines.)