MCPcopy Index your code
hub / github.com/lawlite19/MachineLearning_Python / featureNormalize

Function featureNormalize

PCA/PCA.py:80–90  ·  view source on GitHub ↗

(每一个数据-当前列的均值)/当前列的标准差

(X)

Source from the content-addressed store, hash-verified

78
79# 归一化数据
80def featureNormalize(X):
81 '''(每一个数据-当前列的均值)/当前列的标准差'''
82 n = X.shape[1]
83 mu = np.zeros((1,n));
84 sigma = np.zeros((1,n))
85
86 mu = np.mean(X,axis=0) # axis=0表示列
87 sigma = np.std(X,axis=0)
88 for i in range(n):
89 X[:,i] = (X[:,i]-mu[i])/sigma[i]
90 return X,mu,sigma
91
92
93# 映射数据

Callers 2

PCA_2DFunction · 0.85
PCA_faceImageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected