数据标准化
1.0-1标准化
python代码:
X = X0.copy() #标准化
for ii in range(X0.shape[0]):
for j in range(X0.shape[1]):
X[ii,j] = (X0[ii,j] - np.min(X0[:,j]))/(np.max(X0[:,j])-np.min(X0[:,j]))
2.z-score标准化(均值为0方差为1)
X = X0.copy() #标准化
for ii in range(X0.shape[0]):
for j in range(X0.shape[1]):
X[ii,j] = ((X0[ii,j] - np.mean(X0[:,j]))/np.std(X0[:,j]))