-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Machine Learning for OpenCV
By :

Most machine learning problems we have discussed so far consist of at least a preprocessing step and a classification step. The more complicated the problem, the longer this processing chain might get. One convenient way to glue multiple processing steps together and even use them in grid search is by using the Pipeline
class from scikit-learn.
The Pipeline
class itself has a fit
, a predict
, and a score
method, which behave just like any other estimator in scikit-learn. The most common used case of the Pipeline
class is to chain different preprocessing steps together with a supervised model like a classifier.
Let's return to the breast cancer dataset from Chapter 5, Using Decision Trees to Make a Medical Diagnosis. Using scikit-learn, we import the dataset and split it into training and test sets:
In [1]: from sklearn.datasets import load_breast_cancer ... import numpy as np ... cancer = load_breast_cancer...