November 2017
Intermediate to advanced
1035 pages
11h 31m
English
Now that we've used Pipelines and data transformation techniques, we'll walk through a more complicated example that combines several of the previous recipes into a pipeline.
In this section, we'll show off some more of Pipeline's power. When we used it earlier to impute missing values, it was only a quick taste; we'll chain together multiple preprocessing steps to show how Pipelines can remove extra work.
Let's briefly load the iris dataset and seed it with some missing values:
>>> from sklearn.datasets import load_iris >>> import numpy as np >>> iris = load_iris() >>> iris_data = iris.data >>> mask = np.random.binomial(1, .25, iris_data.shape).astype(bool) >>> iris_data[mask] = np.nan >>> iris_data[:5] ...
Read now
Unlock full access