Skip to content

RandomSearchTuner

RandomSearchTuner

RandomSearchTuner(num_trials: int = 100, automatic_search_space: bool = False, parallel_trials: int = 1, max_trial_duration: Optional[float] = None)

Bases: AbstractTuner

Tuner using random search.

The candidate hyper-parameter can be evaluated independently and in parallel.

Attributes:

Name Type Description
num_trials

Number of hyperparameter configurations to evaluate.

automatic_search_space

If true, automatically define the search space of hyperparameters. In this case, configuring the hyperparameters manually (e.g. calling "choice(...)" on the tuner) is not necessary.

parallel_trials

Number of trials to evaluate in parallel. The training of an individual model uses "num_threads" threads (configured in the learner). Therefore, in the non-distributed training setting, the total number of threads will be parallel_trials x num_threads. In the distributed training setting, the average number of user threads per worker will be parallel_trials x num_threads // num_workers. In this case, make sure parallel_trials is a multiple of the number of workers.

max_trial_duration

Maximum training duration of an individual trial expressed in seconds. This parameter is different from the maximum_training_duration_seconds learner parameter that define the maximum total training and tuning duration. Set to None for no time limit.

train_config property

train_config: TrainingConfig

Gets the training configuration proto.

choice

choice(key: str, values: HyperParameterSequence, merge: bool = False) -> SearchSpace

Adds a hyperparameter with a list of possible values.

Parameters:

Name Type Description Default
key str

Name of the hyperparameter.

required
values HyperParameterSequence

List of possible values.

required
merge bool

If false (default), raises an error if the hyperparameter already exist. If true, and if the hyperparameter already exist, adds "values" to the already configured values. If true, and if the hyperparameter does not already exist, raises an error.

False

Returns:

Type Description
SearchSpace

The conditional SearchSpace corresponding to the values in "values".

set_base_learner

set_base_learner(learner: str) -> None

Sets the base learner key.

set_base_learner_num_threads

set_base_learner_num_threads(num_threads: int) -> None

Sets the number of threads in the base learner.