July 2019
Beginner to intermediate
740 pages
16h 52m
English
We saw in Chapter 9, Getting Started with Machine Learning in Python, that the Pipeline class made streamlining our machine learning processes a cinch, but unfortunately, we can't use it with the partial_fit() method. To get around this, we can create our own PartialFitPipeline class, which is a subclass of the Pipeline class, but supports calling partial_fit(). The PartialFitPipeline class is in the ml_utils.partial_fit_pipeline module.
We simply inherit from sklearn.pipeline.Pipeline and define a single new method—partial_fit()—that will call fit_transform() on all the steps except the last one, and partial_fit() on the last step:
from sklearn.pipeline import Pipelineclass PartialFitPipeline(Pipeline): ...
Read now
Unlock full access