Range Normalization is a normalization technique that allows you to map a number to a specific range.
Lets say that we have a data set where the values are in a range of 1 to 10, however we wish to normalise it to a range between 0 and 5
Mathematically speaking the equation comes down to


translated to Python
class Normaliser:
def \_\_init\_\_(self,dH,dL,nH,nL):
self.dH = dH
self.dL = dL
self.nH = nH
self.nL = nL
def normalize(self,x):
return ((x - self.dL) / (self.dH - self.dL)) * (self.nH - self.nL) + self.nL
def denormalize(self,x):
return ((self.dL - self.dH) * x - self.nH * self.dL + self.dH * self.nL) / (self.nL - self.nH)
if \_\_name\_\_ == "\_\_main\_\_":
norm = Normaliser(10,1,5,0);
for a in range(1,11):
x = norm.normalize(a);
y = norm.denormalize(x);
print str(a) + " : " + str(x) + " : " + str(y)
The results