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!


1 Answer 1


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 = \|x \|_\infty = \max |x_i|$

Edit: previously, using Max does not take absolute values first, so it is not equal to the $l_\infty$ norm -- however, that seems to have been updated and now it is equal to the infinity norm

(source code)

  • $\begingroup$ If Max does not take absolute values first, would you get strange results when all the $x_i$ are negative, or worse if one or more were 0 and the rest negative? $\endgroup$
    – Henry
    Feb 16, 2022 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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