optional#
- skrub.optional(value, *, name=None)[source]#
Construct a choice between a value and
None
.This is useful for optional steps in a pipeline. If we want to try our pipeline with or without dimensionality reduction, we can add a step such as:
>>> from sklearn.decomposition import PCA >>> from skrub import optional >>> optional(PCA(), name='use dim reduction') optional(PCA(), name='use dim reduction')
The constructed parameter grid will include a version of the pipeline with the PCA and one without.