Python:是否可以对具有多个维度的向量进行PCA?

问题描述 投票:0回答:1

我想尝试使用描述PCAhere

from sklearn.decomposition import PCA
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
pca = PCA(n_components=2)
pca.fit(X)
PCA(n_components=2)

是否可以对具有不同维数的数组进行如下操作?

X = np.array([[-1, -1], [-2, -1], [-3, -2, 3], [1, 1], [2, 1], [3, 2, 3]])

如果我尝试以下错误:

pca = PCA(n_components=2)
pca.fit(X)
ValueError: setting an array element with a sequence.
python scikit-learn pca
1个回答
0
投票

不,鉴于主成分分析的数学背景,这是不可能的。 PCA是高维空间中的旋转。

© www.soinside.com 2019 - 2024. All rights reserved.