Home > OS >  The solution genuflect is begged
The solution genuflect is begged

Time:11-21

The from numpy import *
The from pylab import *
Def pca (X) :
Num_data, dim=X.s hape
Mean_X=X.m ean (axis=0)
X=X - mean_X
If dim> Num_data:
M=dot (X, X.T)
E, the EV=linalg. Eight (M)
EV, TMP=dot (X.T) T
V=TMP/: : - 1
S=SQRT (e)] [: : - 1
For I in range (v. hape [1]) :
V [, I]/=S
The else:
U, S, V=linalg. SVD (X)
V=V [: num_data]
Return the V, S, mean_X
According to the book but appear the following error playing the name 'dim' is not defined, don't know how to solve

CodePudding user response:

Um_data, dim
Is this a comma or full stop?

CodePudding user response:

The book was written a comma
  • Related