Min-max scaling is similar to z-score normalization in that it will replace every value in a column with a new value using a formula. In this case, that formula is:
m = (x -xmin) / (xmax -xmin)
Where:
- m is our new value
- x is the original cell value
- xmin is the minimum value of the column
- xmax is the maximum value of the column
Using this formula, we will see that the values of each column will now be between zero and one. Let's take a look at an example using a built-in scikit-learn module:
# import the sklearn modulefrom sklearn.preprocessing import MinMaxScaler#instantiate the classmin_max = MinMaxScaler()# apply the Min Max Scalingpima_min_maxed = pd.DataFrame(min_max.fit_transform(pima_imputed), columns=pima_column_names) ...