Feature scaling
Often, the features we want to use in our model are on very different scales. Put another way, the distance between the min and max values, or the range, varies substantially across possible features. In the COVID-19 data for example, the total cases
feature goes from 5,000 to almost 100 million, while aged 65 or older
goes from 9 to 27 (the number represents the percent of population).
Having features on very different scales impacts many machine learning algorithms. For example, KNN models often use Euclidean distance, and features with greater ranges will have greater influence on the model. Scaling can address this problem.
We will go over two popular approaches to scaling in this section: min-max scaling and standard (or z-score) scaling. Min-max scaling replaces each value with its location in the range. More precisely:
Here, zij is the min-max score, xij is the value for the ith observation of the jth feature, and minj and maxj are the min and...