Sklearn PCA是pca.components_的负载吗? [英] Sklearn PCA is pca.components_ the loadings?
问题描述
Sklearn PCA是否为pca.components_?我很确定,但是我正在尝试研究论文,并且从加载量中得到了不同的结果.我在sklearn文档中找不到它.
Sklearn PCA is pca.components_ the loadings? I am pretty sure it is, but I am trying to follow along a research paper and I am getting different results from their loadings. I can't find it within the sklearn documentation.
推荐答案
pca.components_
是将数据投影到的空间的正交基础.它的形状为(n_components, n_features)
.如果要保留具有100个样本和50个维度(也称为要素)的数据集的前三个成分(例如进行3D散点图),则pca.components_
将具有形状(3, 50)
.
pca.components_
is the orthogonal basis of the space your projecting the data into. It has shape (n_components, n_features)
. If you want to keep the only the first 3 components (for instance to do a 3D scatter plot) of a datasets with 100 samples and 50 dimensions (also named features), pca.components_
will have shape (3, 50)
.
我认为您所说的载荷"是每个样本投影到组件所跨越的向量空间中的结果.可以通过在调用pca.fit(X_train)
之后调用pca.transform(X_train)
获得这些.结果将具有形状(n_samples, n_components)
,在我们之前的示例中为(100, 3)
.
I think what you call the "loadings" is the result of the projection for each sample into the vector space spanned by the components. Those can be obtained by calling pca.transform(X_train)
after calling pca.fit(X_train)
. The result will have shape (n_samples, n_components)
, that is (100, 3)
for our previous example.
这篇关于Sklearn PCA是pca.components_的负载吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!