Normalize and de-normalizing data in prediction model

331 views Asked by At

I have developed a Random Forest model which is including two inputs as X and one output as Y. I have normalized both X and Y values for the training process. After the model get trained, I selected the dataset as an unseen data for an input for the model. The data is coming from another resource. I normalized the X values and imported them to the trained model and get the Y-normalized value as an output. I wonder how the de normalizing process would be. I mean I have to multiply the output by which value to get the denormalized value? I'd appreciate it if someone can help me in this regard.

1

There are 1 answers

0
Mehran Habibzadeh On

You need to do the prepossessing inversely. But, you the mean and sd (standard deviation) values that used for normalization. For example with scikit learn you can do it easily. You can do it with 1 line of code.

enter code here

from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
data= ...

scaled_data = scaler.fit_transform(data)
inverse = scaler.inverse_transform(scaled_data)