September 2019
Intermediate to advanced
420 pages
10h 29m
English
Using a pipeline in a grid search works the same way as using any other estimator.
We define a parameter grid to search over and construct GridSearchCV from the pipeline and the parameter grid. When specifying the parameter grid, there is, however, a slight change. We need to specify for each parameter which step of the pipeline it belongs to. Both parameters that we want to adjust, C and gamma, are parameters of SVC. In the preceding section, we gave this step the name "svm". The syntax to define a parameter grid for a pipeline is to specify for each parameter the step name, followed by __ (a double underscore), followed by the parameter name.
Hence, we would construct the parameter grid as follows:
In [8]: ...
Read now
Unlock full access