Python Machine Learning Cookbook(Second Edition)
上QQ阅读APP看书,第一时间看更新

Getting ready

To normalize data, the preprocessing.normalize() function can be used.  This function scales input vectors individually to a unit norm (vector length). Three types of norms are provided, l1l2, or max, and they are explained next. If x is the vector of covariates of length n, the normalized vector is y=x/z, where z is defined as follows:

The norm is a function that assigns a positive length to each vector belonging to a vector space, except 0.