choose_int#

skrub.choose_int(low, high, *, log=False, n_steps=None, name=None, default=None)[source]#

A choice of integers from a numeric range.

When a pipeline is used without hyperparameter tuning, the outcome of this choice is the middle of the range (possibly on a log scale). Pass an int as the default argument to set the default outcome.

Parameters:
lowint

The start of the range.

highint

Then end of the range. It is included in the possible outcomes.

logbool, optional (default=False)

Whether sampling should be done on a logarithmic scale.

n_stepsint, optional (default=None)

If not None, a grid of n_steps values across the range is defined and sampling is done on that grid. This can be useful to limit the number of unique values that get sampled, for example to improve the effectiveness of caching. However, it means a much more restricted space of possible values gets explored.

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.

defaultint, optional (default=None)

If provided, override the choice’s default value when hyperparameter search is not used. Otherwise the default value is the integer closest to the middle of the range (either on a linear or logarithmic scale depending on the value of log).

Returns:
numeric choice

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

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_from

Construct a choice among several possible outcomes.