lenskit.schemas.tuning.SearchConfig#

class lenskit.schemas.tuning.SearchConfig#

Bases: pydantic.BaseModel

Configuration options for the hyperparameter search.

method: Literal['tpe', 'random', 'hyperopt'] | None = None#

The search method to use.

max_points: int | None = None#

The maximum number of points to try.

default_points: int = 60#

The default number of search points, if not limited by a maximum configuration.

error_action: ErrorAction = 'continue'#

What to do when one of the search trials fails.

metric: str | None = None#

The metric to use.

list_length: int | None = None#

The length of recommendation lists to use.

num_cpus: int | Literal['threads', 'backend-threads', 'all-threads'] = 'threads'#

The number of CPUs to request from Ray Tune.

num_gpus: int | float = 0#

The number of GPUs to requrest from Ray Tune.

max_epochs: int = 100#

The maximum number of epochs to use in iterative training.

min_epochs: int = 3#

The minimum number of epochs for iterative training.

median_min_trials: int = 5#

The minimum number of trials at an epoch for the median pruner to consider pruning.

plateau_check_iters: int = 3#

The number of iterations to check for the plateau stopper.

plateau_min_rel_improvement: float = 0.01#

The minimum relative improvement to continue the trial.

checkpoint_iters: int = 2#

The frequency for saving checkpoints (only supported by Ray).

resolved_direction()#

Get the metric optimization direction.

Return type:

Literal[‘min’, ‘max’]

update_max_points(n)#

Limit the search points to a new maximum, if it exceeds the current maximum.

Parameters:

n (int | None)

num_search_points()#

Get the number of search points to use.

Return type:

int

merge(other)#

Produce a new configuration by merging another configuration into this one.

Parameters:

other (SearchConfig) – The other configuration to merge.

Returns:

The combination of self and other, where values from other are preferred in case of conflict.

Return type:

SearchConfig