Rescaling data to its initial state after applying MinMax scaling

XbiTake report abuse

To scale my data I used a MinMaxScaler provided in the sklearn package. But I wonder if there any way to "rescale" it back to its original state?


KoloNuto report abuse

You can use the inverse_transform method from the sklearn library. Let's look at the example.

Suppose you have the data cols = ['One', 'Two'] data = pd.DataFrame(np.array([[2,3],[1.02,1.2],[0.5,0.3]]),columns=cols)

So that we have the following output:

After applying the min-max scaling we obtain the next result ( scaler = preprocessing.MinMaxScaler(featurerange = (0,1)) scaleddata = scaler.fit_transform(data[cols])

After applying inversetransform() method we get our data at its initial range back ( scaler.inversetransform(scaled_data)

XbiTake report abuse

Brilliant, that's it! Thank you!

Add Answer

Need support?

Just drop us an email to ... Show more