Skip to content

Commit d31823c

Browse files
committed
📝 PCA主成分分析,数据降维
1 parent d3e367e commit d31823c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

readme.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -950,12 +950,12 @@ def runKMeans(X,initial_centroids,max_iters,plot_process):
950950
- ![$${X_{approx}} = {(U_{reduce}^{ - 1})^{ - 1}}Z = {U_{reduce}}Z$$](http://latex.codecogs.com/gif.latex?%5Cfn_cm%20%24%24%7BX_%7Bapprox%7D%7D%20%3D%20%7B%28U_%7Breduce%7D%5E%7B%20-%201%7D%29%5E%7B%20-%201%7D%7DZ%20%3D%20%7BU_%7Breduce%7D%7DZ%24%24)
951951
- 实现代码:
952952
```
953-
# 恢复数据
954-
def recoverData(Z,U,K):
955-
X_rec = np.zeros((Z.shape[0],U.shape[0]))
956-
U_recude = U[:,0:K]
957-
X_rec = np.dot(Z,np.transpose(U_recude)) # 还原数据(近似)
958-
return X_rec
953+
# 恢复数据
954+
def recoverData(Z,U,K):
955+
X_rec = np.zeros((Z.shape[0],U.shape[0]))
956+
U_recude = U[:,0:K]
957+
X_rec = np.dot(Z,np.transpose(U_recude)) # 还原数据(近似)
958+
return X_rec
959959
```
960960

961961
### 6、主成分个数的选择(即要降的维度)

0 commit comments

Comments
 (0)