I was wondering if anyone here can explain the difference between the l1, l2 and max normalization mode in sklearn.preprocessing.normalize() module? Having read the documentation I couldn't realize the difference!


The options lead to different normalizations. if $x$ is the vector of covariates of length $n$, and say that the normalized vector is $y = x / z$ then the three options denote what to use for $z$:

  • L1: $z = \| x\|_1 = \sum_{i=1}^n |x_i|$
  • L2: $z = \| x\|_2 = \sqrt{\sum_{i=1}^n x_i^2}$
  • Max: $z = \max x_i$

Note that using Max does not take absolute values first, so it is not equal to the $l_\infty$ norm.

(source code)

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.