April 2017
Beginner to intermediate
358 pages
9h 30m
English
To start, open up the Jupyter Notebook that we used for the Adult dataset. Then, click on the Cell menu item and choose Run All. This will rerun all of the cells and ensure that the notebook is up to date.
First, we import the TransformerMixin, which sets the API for us. While Python doesn't have strict interfaces (as opposed to languages like Java), using a mixin like this allows scikit-learn to determine that the class is actually a transformer. We also need to import a function that checks the input is of a valid type. We will use that soon.
Let's look at the code:
from sklearn.base import TransformerMixinfrom sklearn.utils import as_float_array
Let's take a look at our class in entirety, and then we will revisit ...
Read now
Unlock full access