What if the minimum and maximum values are the same?


#1

Question

This exercise explained how we could use min-max normalization so that different features are weighed similarly. What happens if the minimum and maximum for some feature are the same?

Answer

It is unlikely, but possible, that the minimum and maximum values for some feature are the same value. In that case, our calculation for normalization would fail, due to division by zero.

(value-minimum) / (maximum-minimum)

To account for this possibility, one thing you can do is skip the calculation, and instead set all the values of that feature to the same value, say 0 or 1, for each data point. This way, they will all be weighed the same.

However, we may determine that when all values are the same, then this does not provide any useful information to us. So, we might also consider excluding that feature entirely. For example, say that we had a dataset for animal physical features and that every animal in our dataset had two legs. Since we know that each animal has two legs, then we might exclude that feature in our calculations.