# Data transformation

hello everyone,
We’ve seen that in case data are not normally distributed we have to perform a transformation so that we have a normal distribution to fit it to our anomaly detection model, but i don’t understand how this can works always because the transformation may cause some loss in the original data . Here is what i mean , suppose we have to perform the following transformation x to x^2 in order to get a normal distribution and suppose a data point x1=1 is considered as normal one while x2= -1 is considered as an anomalous datapoint.In this case we will end up with x2 as a normal example which is wrong.

That is an example where the transformation you used is not appropriate for that set of data.

Hi @abdou_brk,

Then you can try to add a constant to shift the range to positive, for example, add 2 to change it from a range of (-1, 1) as you exemplified to a range of (1, 2).

In the positive range, transformation by x^2 is monotonic, so it will only change the shape of the distribution without reordering the samples.

Cheers,
Raymond