We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a23263 commit ce045fdCopy full SHA for ce045fd
1 file changed
readme.md
@@ -1008,21 +1008,22 @@ from sklearn.preprocessing import StandardScaler
1008
x_train = scaler.transform(X)
1009
```
1010
- 使用PCA模型拟合数据,并降维
1011
+ - `n_components`对应要将的维度
1012
1013
'''拟合数据'''
1014
K=1 # 要降的维度
1015
model = pca.PCA(n_components=K).fit(x_train) # 拟合数据,n_components定义要降的维度
1016
Z = model.transform(x_train) # transform就会执行降维操作
1017
- - `n_components`对应要将的维度
1018
1019
- 数据恢复
1020
+ - `model.components_`会得到降维使用的`U`矩阵
1021
1022
'''数据恢复并作图'''
1023
Ureduce = model.components_ # 得到降维用的Ureduce
1024
x_rec = np.dot(Z,Ureduce) # 数据恢复
1025
- - `model.components_`会得到降维使用的`U`矩阵
1026
+
1027
1028
1029
---------------------------------------------------------------
0 commit comments