How to normalize and denormalize data between 0 and 1

Some AI algo works better with values between 0 and 1 but it is rare to have data already between 0 and 1.

The following formula will show you how to convert an array of data to a normalized

Normalize = ($inputvalue – $min) / ($max – $min)
0.111 = (2-1)/(10-1)

Denormalized = ($normalizedValue * ($max-$min) + $min)
3 = (0.22222 * (10-1) + 1)

Input Value Normalise Denormalise
($inputvalue – $min) / ($max – $min) ($normalizedValue * ($max-$min) + $min)
1 0 1
2 0.111111111 2
3 0.222222222 3
4 0.333333333 4
5 0.444444444 5
6 0.555555556 6
7 0.666666667 7
8 0.777777778 8
9 0.888888889 9
10 1 10