Normalization – How to Normalize Data to 0-1 Range?

normalization

I am lost in normalizing, could anyone guide me please.

I have a minimum and maximum values, say -23.89 and 7.54990767, respectively.

If I get a value of 5.6878 how can I scale this value on a scale of 0 to 1.

Best Answer

If you want to normalize your data, you can do so as you suggest and simply calculate the following:

$$z_i=\frac{x_i-\min(x)}{\max(x)-\min(x)}$$

where $x=(x_1,...,x_n)$ and $z_i$ is now your $i^{th}$ normalized data. As a proof of concept (although you did not ask for it) here is some R code and accompanying graph to illustrate this point:

enter image description here

# Example Data
x = sample(-100:100, 50)

#Normalized Data
normalized = (x-min(x))/(max(x)-min(x))

# Histogram of example data and normalized data
par(mfrow=c(1,2))
hist(x,          breaks=10, xlab="Data",            col="lightblue", main="")
hist(normalized, breaks=10, xlab="Normalized Data", col="lightblue", main="")
Related Question