sklearn MinMaxScaler: Inverse does not equal original

I am using MinMaxScaler on a large dataset (2201887, 3) to normalize features. Inversed values does not match originals. I tested with the target column, first (a), I applied the scaler on 10 values, then did the inverse transformation and I was able to get original values. Then (b), I inverted 10 normalized values after applying MinMaxScaler on the whole column and results were completely different :

Result of (a) :

Result of (b) :

How can I have the same normalized and inversed values when used with the whole dataset?

Topic lstm normalization feature-scaling deep-learning neural-network

Category Data Science


I wasn't able to reproduce the issue as inverse_transform(b) threw an error because it was trained on a (,3) array but the input is only (,1). Not sure if I typoed or how your code runs.

You could try instantiating a new MinMaxScaler, as I'm not sure if anything weird happens if you refit it.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.