# How do you choose the min and max for the min-max normalization on a histogram classifier?

Please let me know what to do when there is a value in the testing set is bigger than the max value used to min-max normalize the training set building a histogram classifier.

Do I go back and change the bounds of the min-max normalization for the training set? Wouldn't that violate the notion that your training set should generalize to any testing set on its own and that you should retroactively change the what was done during the classifier building on the training set based on future testing sets that you are not supposed to know?

Do I change the bounds of the min-max normalization to the the min and max of the testing set? But, you are supposed to use the same transformation on the testing set as the training set, right?

Or, do I just let there be a bin on either side of the normalized histogram that such that everything that gets (not actually) normalized above (below) the interval [0,1] goes into the bin for all values (below) the interval?

Or, do I just exclude values that get transformed outside of the histogram's interval?

None of these seem right. Please let me know if I am missing an option.

• You can't know what you are going to get ahead of time, so mileage varies. I like to use the Tukey-Kramer outlier threshold to extend beyond the sample max and min. There is a whole subset of actuarial stats that applies to inferring actual likely max and min given more samples, starting from few samples. (stats.stackexchange.com/questions/158767/…) Aug 27, 2020 at 17:18

## 2 Answers

First, apply min-max normalization on the training set rather than the whole data set. Then, use the minimum and maximum of the training set to normalize the test set. Because, the test set is unseen by the model and should be normalized using the minimum and maximum of the training set (seen by the model).

First build the min-max normalization on the entire data set. Then apply different workloads to your train and test split(s) separately. If you believe your data set will change over time you could consider estimating the extreme min and max if you are still interested in this min-max normalization.

• -1 Dangerous advice to peek at the test data
– Dave
Jan 17, 2022 at 2:33
• @Dave It is in many scenarios, however, depending on sampling approaches, the risk increases to miss the min/max and some tools/libraries do not adjust the min/max appropriately (i.e. potentially missing outliers) or raise errors when working with values outside of these ranges. I think there is room for discussion here, however it has been a long time since I've visited this post. I'm seeing that someone gave a comment in response to the concerns I'm raising here. I hope whoever visits this post in the future will find the discussion points useful. Jan 17, 2022 at 17:27