📅  最后修改于: 2022-03-11 14:56:47.136000             🧑  作者: Mango
import numpy as np
from sklearn.decomposition import PCA
pca = PCA(n_components = 3) # Choose number of components
pca.fit(X) # fit on X_train if train/test split applied
print(pca.explained_variance_ratio_)