[sklearn][standardscaler] can I inverse the standardscaler for the model output? [sklearn][standardscaler] can I inverse the standardscaler for the model output? python python

[sklearn][standardscaler] can I inverse the standardscaler for the model output?


Yeah, and it's conveniently called inverse_transform.

The documentation provides examples of its use.


Here is sample code. You can replace here data with train_df['colunm_name']. Hope it helps.

from sklearn.preprocessing import StandardScalerdata = [[1,1], [2,3], [3,2], [1,1]]scaler = StandardScaler()scaler.fit(data)scaled = scaler.transform(data)print(scaled)# for inverse transformationinversed = scaler.inverse_transform(scaled)print(inversed)