0
$\begingroup$

I want to normalise a set of range of values having 0 Min and a Max that is known but can vary; say 22000 and would like to normalise these values from 0 to 300 and also from 0 to 20. I found a formula here on stack Exchange that is a general formula. The general one-line formula to linearly rescale data values having observed min and max into a new arbitrary range min' to max' is:

newvalue= (max'-min')/(max-min)*(value-max)+max'

I have used it for my purpose, but would like to know how this formula is derived from the following:

newvalue = a * value + b. a = (max'-min')/(max-min) and b = max' - a * max

How can I reference it or back it? And is it the right way to normalise anyway? Any help would be appreciated.

$\endgroup$
1
  • $\begingroup$ Since "two points determine a line", it suffices to check both of your formulas agree at two distinct points, i.e. value = min and value = max give newvalue = min' and newvalue = max' respectively. $\endgroup$
    – hardmath
    Commented Dec 1, 2015 at 3:44

1 Answer 1

1
$\begingroup$

For how the formula is derived, think about it this way. You have a value, $V$, which lies between a minimum $A$ and a maximum $B$. You want to rescale so it to a new value $v$ so it is between $a$ and $b$ instead. Without knowing anything else about the application, it is simplest to assume that what matters in this rescaling is "how far between $A$ and $B$ is $V$," or, "what is the distance between $A$ and $V$ compared to the maximum distance between $A$ and $B$."

So to preserve this in the rescaling you make the ratio $(V-A)/(B-A)$ the same as the ratio $(v-a)/(b-a)$: $${V-A\over B-A}={v-a\over b-a}$$ And you can easily solve for $v$: $$v=a+(b-a){V-A\over B-A}$$

(The formula you cite has min and max reversed from the one I show here, but it actually gives the same answer. You can see this by subtracting both sides of my first equation from 1.)

Whether this is the "right" way to rescale it depends entirely on the application. For instance, maybe your values $V$ have some non-uniform probability distribution between $A$ and $B$, but you want the rescaled values to have a uniform distribution between $a$ and $b$ while preserving the ordering of the values. In this case the linear rescaling would not be the one you wanted.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .