Selecting dimensionality reduction with Pipeline and GridSearchCV
This example constructs a pipeline that does dimensionality
reduction followed by prediction with a support vector
classifier. It demonstrates the use of GridSearchCV and
Pipeline to optimize over different classes of estimators in a
single CV run – unsupervised PCA and NMF dimensionality
reductions are compared to univariate feature selection during
the grid search.
Additionally, Pipeline can be instantiated with the memory
argument to memoize the transformers within the pipeline, avoiding to fit
again the same transformers over and over.
Note that the use of memory to enable caching becomes interesting when the
fitting of a transformer is costly.
