Skip to content

Commit d3e367e

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

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,9 +948,9 @@ def runKMeans(X,initial_centroids,max_iters,plot_process):
948948
- 所以:![$${X_{approx}} = {(U_{reduce}^T)^{ - 1}}Z$$](http://latex.codecogs.com/gif.latex?%5Cfn_cm%20%24%24%7BX_%7Bapprox%7D%7D%20%3D%20%7B%28U_%7Breduce%7D%5ET%29%5E%7B%20-%201%7D%7DZ%24%24) (注意这里是X的近似值)
949949
- 又因为`Ureduce`为正定矩阵,【正定矩阵满足:![$$A{A^T} = {A^T}A = E$$](http://latex.codecogs.com/gif.latex?%5Cfn_cm%20%24%24A%7BA%5ET%7D%20%3D%20%7BA%5ET%7DA%20%3D%20E%24%24),所以:![$${A^{ - 1}} = {A^T}$$](http://latex.codecogs.com/gif.latex?%5Cfn_cm%20%24%24%7BA%5E%7B%20-%201%7D%7D%20%3D%20%7BA%5ET%7D%24%24)】,所以这里:
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)
951-
- 实现代码:
951+
- 实现代码:
952952
```
953-
# 恢复数据
953+
# 恢复数据
954954
def recoverData(Z,U,K):
955955
X_rec = np.zeros((Z.shape[0],U.shape[0]))
956956
U_recude = U[:,0:K]

0 commit comments

Comments
 (0)