It is clearly possible that when you square each value in your list and normalize them back, you cannot get them back in the same range.
For example : if you take [2, 3, 5]
.
After squaring, you will get [4, 9, 25]
.
You can normalize this in a way such that the range is between 0 to 1 i.e you divide all the elements by the largest value getting [0.16, 0.36, 1]
.
I don't think this list can be scaled back such that the range becomes the same as before.
Correct me if I'm wrong.
Normalizing a list of values between a range
Question
So let's say I have something like this:
values = [10.0, 12.0, 14.0, 16.0, 18.0, 20.0]
I basically want to multiply everything in the list by a power of 2, but then normalize it back down to range it was in.
This is how I was attempting to do it, but not getting the results I expected.
minVal = min(values)
maxVal = max(values)
normValues = [((q**2)-minVal)/(maxVal - minVal) for q in values]
Any help would greatly be appreciated!
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow