# Feature scaling

Sometimes the features have completely different scales. For example lets imagine a website displaying a list of movies. Each movie has a score between 0 – 10 and also displays the number of likes, that represents how many people has clicked on the button “I like the movie”. We cannot calculate an average of these two features because they have completely different scales.

### Scaling formula

To solve this problem we can scale both features to values between 0 and 1 using the following formula:

### Practical example

We have the movie “Ex machina” with the following features:

• Score: 8
• Number of likes: 300,000

Given that the maximum number of likes is 600,000, which is the scaled value of both values combined?

#### Calculate the scaled score

We apply the formula to the Score:

#### Calculate the scaled number of likes

Now we apply the formula to the number of likes:

Finally we have the features within the same scale:

• scaled score = 0.8
• scaled number of likes = 0.5

So now we can calculate the average normally. Note that this would only make sense when we are comparing features that are somehow related.