# Normalization with learning/test dataset in [0,1]

Say you split your data into two sets: training and test sets. You know that the inputs of your data are in [lower_bounds, upper_bounds]. Now, assume that you would like to do a min-max normalization on your inputs between $$[0, 1]$$. For the values of the max and the min, should you use the min/max of your learning dataset or the bounds [lower_bounds, upper_bounds]?

In the same way, in order to normalize your test set, you should use the same bounds as the ones used for the learning dataset. If you use the min/max of your training set, some of your values in the test set can be found outside of $$[0, 1]$$, if, for instance, some values of the test set are greater than the max of the data in the learning dataset. Is it an issue?

• Always scale with the values of the training set Sep 8, 2021 at 21:18
• Thank you. One more question: when you get your training data from an LHS (en.wikipedia.org/wiki/Latin_hypercube_sampling), do you use as min/max values the lower bounds/upper bounds used in the LHS or the min/max computed from the training data obtained? Sep 8, 2021 at 21:27
• Not being familiar with LHS, I‘m actually not sure. I tend to say scale after LHS. Just try it. Ultimately scaling (based on the distribution of the train set) should improve the predictive power. Not using the test set (but scaling it instead on the basis of the min/max or whatever of the train set) simply is due to the fact that you cannot know the distribution of truly „new“ data in advance. Sep 8, 2021 at 21:35

If your in-sample data set is $$\{1,2,3,4,5,6\}$$ and your test set is $$\{1,3,7\}$$, you would do your normalization based on the in-sample set and accept that the $$7$$ in the test set will be normalized to a value exceeding $$1$$.