标签:divide mda pytho 学习 使用 机器学习 pre ges new
def autoNorm(dataSet):#归一化,使用公式为 newValue=(oldValue-min)/(max-min)
minVals = dataSet.min(0)
maxVals = dataSet.max(0)
ranges = maxVals - minVals
normDataSet = zeros(shape(dataSet))
m = dataSet.shape[0]
normDataSet = dataSet - tile(minVals, (m,1))
normDataSet = normDataSet/tile(ranges, (m,1)) #element wise divide
return normDataSet, ranges, minVals
标签:divide mda pytho 学习 使用 机器学习 pre ges new
原文地址:https://www.cnblogs.com/jiading/p/11621875.html