机器学习笔记

数据预处理

归一化

import numpy as np x_1 = np.random.ramdint(0,10,size =10 ) x_2 - np.random.randint(10000,500000,size=10)

X=np.c_[x_1,x_2]

X_norm = (X-X.min(azis = 0)/X.max(axis = 0))-X.min(axis = 0)

0-均值归一化

import numpy as np

x_1 = np.random.ramdint(0,10,size =10 ) x_2 - np.random.randint(10000,500000,size=10)

X_norm = X - X.mean(axis = 0)/(X.std = axis = 0)