【发布时间】:2015-05-03 13:41:03
【问题描述】:
我通常会收到这样的 PCA 加载:
pca = PCA(n_components=2)
X_t = pca.fit(X).transform(X)
loadings = pca.components_
如果我使用 scikit-learn 管道运行 PCA:
from sklearn.pipeline import Pipeline
pipeline = Pipeline(steps=[
('scaling',StandardScaler()),
('pca',PCA(n_components=2))
])
X_t=pipeline.fit_transform(X)
是否有可能获得负载?
简单地尝试loadings = pipeline.components_ 失败:
AttributeError: 'Pipeline' object has no attribute 'components_'
(也有兴趣从管道中提取coef_ 等属性。)
【问题讨论】:
标签: python scikit-learn pipeline