I have a supervised learning regression task: I am trying to forecast demand for a product based on sales in past years.

Data description:

Samples (rows) - Demand for a certain product (at a certain month, in a certain year). Number of rows: 2,400

X Variables (columns) - Explanatory variables. Most of them are categorical (which I turned into dummy variables), 2 of them are continuous ("Price Per Unit", "GDP"). Number of X variables: ~20

Y Variable (target): Demand in units.

I decided to use Random Forest Regression and MLP Regression for the task, using Python & scikit-learn. For both models, I used StandardScalar to scale the continuous values, and then used RandomSearch for hyper-parameter tuning to find the optimal model.

My question:

After finding the optimal parameters, do I need to fit the model again (with the same optimal parameters) but on the original, un-scaled values? (Is the scaling meant to be only for FINDING the optimal parameters?)

Also, when predicting values for new data: do I need to scale the values again, or do I just use the original, un-scaled data? (If I scale them, the model will return scaled Y predictions, which I cannot interpret as a solid demand in meters...)

  • $\begingroup$ if scalijng is used (there are valid reasons to re-scale data), then it is used everywhere, in training in testing in prediction, in hyper - search everywhere $\endgroup$
    – Nikos M.
    Commented May 12, 2021 at 19:09
  • $\begingroup$ But then I get a scaled predication, instead of the demand forecast. Then what? $\endgroup$
    – G. M.
    Commented May 12, 2021 at 21:32
  • 1
    $\begingroup$ You only scale the X, not the Y. $\endgroup$
    – 10xAI
    Commented May 13, 2021 at 13:06
  • $\begingroup$ @10xAI that was my problem... Thanks!! $\endgroup$
    – G. M.
    Commented May 16, 2021 at 16:11


Your Answer

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