I have applied data scaling techniques on my training dataset during training.

For evaluation, when scaling the test dataset, should it be scaled using the scalers fitted to the training dataset or the test dataset?

  • 5
    $\begingroup$ This previous post answers probably your question: datascience.stackexchange.com/questions/39932/… $\endgroup$ Jun 30, 2021 at 7:29
  • 1
    $\begingroup$ The point here as both Erwan and Nicolas have mentioned is that only the training set is supposed to be known, so feature transformations are derived only from the train set. Then in production the input data are transformed by the transformation derived from the train set. This includes the test dataset which is a simulation of a dataset used in production $\endgroup$
    – Nikos M.
    Jun 30, 2021 at 12:15
  • 1
    $\begingroup$ This fact that only the training set is supposed to be known to us, and all feature transformations are this derived from it only, has as consequence that in order to derive valid transformations the training set has to be representative of the underlying distribution. Thus the way the training set is collected should be such that it covers all cases in the percent that they occur $\endgroup$
    – Nikos M.
    Jun 30, 2021 at 12:28