Say I have an integer value coming from a hardware sensor, and I don’t know its bounds, what’s the best way to normalize this value to a bounded range, like [0-1]?
From experimentation, I know what the upper and lower bounds are likely to be, but I don’t have strict values for those. I also know the value grows exponentially.
You have upper and lower bounds corresponding to
MIN_INTandMAX_INT. MapMAX_INTto 1 andMIN_INTto 0; divide each inputxbyMAX_INT + |MIN_INT|. This will map the values into the required range but it won’t necessary be optimal (i.e., you may have unused subranges). If you can approximate the upper and lower bounds, take them and add some value that will ensure safety (i.e., the input can’t deviate from the range with this safety value) and replace theMAX_INTandMIN_INTin the mapping with these calculated boundaries.