I have a df with many features that take both negative and positive values.For example a feature may have values in range (-10 , 10).For each feature which has negative values the negative sign means direction and this -10 is actually a larger value than - 5.
After finilizing my model i tried many scaling techniques such as Minmaxscaler from (0,1) and mean max scaler from (-1,1),robust scaler,standarization and found the minmaxscaler from (0,1) has the best results.
My concern is this: Scaling the data with this technique does not account for the true meaning of my feature as seen belo and -2 will be smaller than -1 after scaling to (0,1).
Is there a way to enforce this rule(negative means only direction) during my scaling process?


2 Answers 2


You could distinguish direction and magnitude by re-expressing the two components of your data format.

  • $| x |$ captures magnitude, reflecting that $-10$ is "larger" than $-5$.
  • the sign $\text{sgn}(x)$ captures directing, with $+1$ indicating one direction and $-1$ the opposite.

This will double the number of features you have, which might not be desirable.


Peculiar to your case, you can scale the absolute values of your features, and then apply your directions, i.e. some sort of magnitude scaling, though I'm not sure it'll provide you performance uplift. In addition, don't expect properties like zero mean, unit variance etc. after performing the scaling this way.

  • $\begingroup$ I got the first part,but i can't understand how direction would be applied by magnitude scaling.Could you explain a bit more? $\endgroup$ Commented Oct 1, 2021 at 9:07
  • 1
    $\begingroup$ I meant just applying the signs after the scaling $\endgroup$
    – gunes
    Commented Oct 1, 2021 at 9:26

Your Answer

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

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