# What's the formula behind Normalization function?

sklearn.preprocessing.Normalizer(norm=l2)

I need to undone a normalization (Normalizer algorithm) within my dataset and I'd like to know which formula I should use for it. I've try both formulas (below) and didn't work out.

• z-score formula: $$X_{original} = (x_{normalized} \cdot \sigma) + \mu$$
• Min-Max formula: $$X_{original} = [x_{normalized} \cdot (X_{max} - X_{min})] + X_{min}$$

Thanks for your attention

## 1 Answer

From the documentation

Each sample (i.e. each row of the data matrix) with at least one non zero component is rescaled independently of other samples so that its norm (l1, l2 or inf) equals one.

So if $$x = (x_1, \ldots, x_p)$$ is a row of the data matrix, the normalizer changes it to $$(x_1 / \|x\|_2, \ldots, x_p/\|x\|_2)$$, where $$\|x\|_2 := \sqrt{x_1^2 + \cdots + x_p^2}$$.

If using norm='l1', then $$\|x\|_2$$ is replaced by $$\|x\|_1 = |x_1| + \cdots + |x_p|$$; if using norm='inf', then $$\|x\|_2$$ is replaced by $$\|x\|_\infty := \max\{|x_1|, \ldots, |x_p|\}$$.