When scaling to vector unit length, we transform the components of a feature vector so that the transformed vector has a length of 1, or in other words, a norm of 1. Note that this scaling technique scales the feature vector, as opposed to each individual variable, compared to what we did in the other recipes in this chapter. A feature vector contains the values of each variable for a single observation. When scaling to vector unit length, we divide each feature vector by its norm.
Scaling to the unit norm is achieved by dividing each observation vector by either the Manhattan distance (l1 norm) or the Euclidean distance (l2 norm) of the vector. The Manhattan distance is given by the sum of the absolute components of the vector:
l1(X) = |x1| + |x2| + ... + |xn|
On the other hand, the Euclidean distance is given by the square root of the square...