Skip to content

VizierTuner

VizierTuner

VizierTuner(
    num_trials: int = 100,
    automatic_search_space: bool = False,
    parallel_trials: int = 1,
    max_trial_duration: Optional[float] = None,
    *,
    cross_validation: bool = False,
    cross_validation_num_folds: Optional[int] = None,
    optimize_metric: Optional[str] = None
)

Bases: AbstractTuner

Tuner using Vizier.

Attributes:

  • 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 (int) –

    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 (int) –

    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.

  • cross_validation (int) –

    Use cross-validation for evaluating the hyperparameter candidates. Cross-validation can provide better evaluation quality but is much slower.

  • cross_validation_num_folds (int) –

    Number of folds to use for cross-validation. Defaults to 5 if not set.

  • optimize_metric (int) –

    Metric to optimize. If not set, the default metric is chosen (loss > auc (binary classification only) > accuracy > rmse > ndcg > qini). Supported metrics are: loss, accuracy, auc, pr-auc, rmse, mae, mse, ndcg@5, mrr@10, qini, cate_calibration (case-insensitive).

Initializes tuner.

Parameters:

  • optimizer_key (str) –

    Registered identifier of the optimizer.

  • automatic_search_space (bool, default: False ) –

    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 (int, default: 1 ) –

    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 (Optional[float], default: None ) –

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

  • cross_validation (bool, default: False ) –

    Use cross-validation for evaluating the hyperparameter candidates. Cross-validation can provide better evaluation quality but is much slower.

  • cross_validation_num_folds (Optional[int], default: None ) –

    Number of folds to use for cross-validation. Defaults to 10 if not set.

  • optimize_metric (Optional[str], default: None ) –

    Metric to optimize. If not set, the default metric is chosen (loss > auc (binary classification only) > accuracy > rmse > ndcg

    qini). Supported metrics are: loss, accuracy, auc, pr-auc, rmse, mae, mse, ndcg@5, mrr@10, qini, cate_calibration (case-insensitive).

parallel_trials property

parallel_trials: int

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:

  • key (str) –

    Name of the hyperparameter.

  • values (HyperParameterSequence) –

    List of possible values.

  • merge (bool, default: False ) –

    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.

Returns:

  • SearchSpace –

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