How it works...
In this recipe, we scaled the numerical variables of the Boston House Prices dataset to their maximum values. To scale these features to their maximum value, we learned and stored this parameter by utilizing MaxAbsScaler() from scikit-learn. First, we loaded the dataset and divided it into train and test sets using the train_test_split() function from scikit-learn. To scale the features, we created an instance of a scaler calling MaxAbsScaler() with its default parameters. With the fit() method, and by taking the train set as an argument, the scaler learned the maximum values for each variable and stored them in its max_abs_ attribute. With the transform() method, the scaler divided the variables in the train and test sets ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access