The min-max scaling method

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) ...

Get Feature Engineering Made Easy now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.