choose_bool#

skrub.choose_bool(*, name=None, default=True)[source]#

A choice between True and False.

When a pipeline is used without hyperparameter tuning, the outcome of this choice is True. Pass default=False to make False the default outcome.

Parameters:
namestr, optional (default=None)

If not None, name is used when displaying search results and can also be used to override the choice’s value by setting it in the environment containing a pipeline’s inputs.

defaultbool, optional (default=True)

Choice’s default value when hyperparameter search is not used.

Returns:
BoolChoice

An object representing this choice, which can be used in a skrub pipeline.

See also

choose_float

Construct a choice of floating-point numbers from a numeric range.

choose_from

Construct a choice among several possible outcomes.

choose_int

Construct a choice of integers from a numeric range.

Examples

>>> import skrub
>>> print(skrub.choose_bool().as_expr().skb.describe_param_grid())
- choose_bool(): [True, False]
>>> skrub.choose_bool().default()
True

We can set the default to make it False:

>>> skrub.choose_bool(default=False).default()
False