Reputation: 7245
I would like to try to do PCA
using the description here
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)
Is it possible to do the same with an array with different dimensions such as the following?
X = np.array([[-1, -1], [-2, -1], [-3, -2, 3], [1, 1], [2, 1], [3, 2, 3]])
if I try I get the following error:
pca = PCA(n_components=2)
pca.fit(X)
ValueError: setting an array element with a sequence.
Upvotes: 1
Views: 1153
Reputation: 52327
No, this is not possible given the mathematical background of Principal Component Analysis. PCA is a rotation in the high-dimensional space.
Upvotes: 1