How to do it...

To begin, we'll import the required packages, load the dataset, and prepare the train and test sets:

  1. Import the required Python packages, classes, and function:
import numpy as npimport pandas as pdfrom sklearn.datasets import load_bostonfrom sklearn.model_selection import train_test_splitfrom sklearn.preprocessing import Normalizer
  1. Let's load the Boston House Prices dataset from scikit-learn into a pandas dataframe:
boston_dataset = load_boston()data = pd.DataFrame(, columns=boston_dataset.feature_names)data['MEDV'] =
  1. Let's divide the data into train and test sets:
X_train, X_test, y_train, y_test = train_test_split( data.drop('MEDV', axis=1), data['MEDV'], test_size=0.3, random_state=0) ...

Get Python Feature Engineering Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.