choose_from#

skrub.choose_from(outcomes, *, name=None)[source]#

Construct a choice among several possible outcomes.

Outcomes can be provided in a list:

>>> from skrub import choose_from
>>> choose_from([1, 2], name='the number')
choose_from([1, 2], name='the number')

They can also be provided in a dictionary to give a name to each outcome:

>>> choose_from({'one': 1, 'two': 2}, name='the number')
choose_from({'one': 1, 'two': 2}, name='the number')

See also

choose_bool

Construct a choice between False and True.

choose_float

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

choose_int

Construct a choice of integers from a numeric range.