#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import numpy as np
from sklearn.decomposition import PCA

X = np.array([[-1,2,66,-1], [-2,6,58,-1], [-3,8,45,-2], [1,9,36,1], [2,10,62,1], [3,5,83,2]])
pca = PCA(n_components=2)
# pca.fit(X) # 训练
newX = pca.fit_transform(X) #降维后的数据
print(pca.explained_variance_ratio_) #降维后的数据
print(newX)