tuners#

Classes#

GridSearchTuner

Hyperparameter tuning using Grid Search.

HyperparameterTuner

Abstract base class for implementing hyperparameter tuners.

OptunaTuner

Hyperparameter tuning using Optuna.

class prt_rl.common.tuners.GridSearchTuner(total_trials: int, maximize: bool = True, num_jobs: int = -1)[source]#

Hyperparameter tuning using Grid Search.

Parameters:
  • total_trials (int) – The number of trials to run.

  • maximize (bool) – Whether to maximize the objective function. Default is True.

  • num_jobs (int) – The number of parallel jobs to run. Default is -1 (use all available cores).

tune(objective_fcn: Callable, parameters: dict) Dict[str, Any][source]#

Tune the hyperparameters of the given model using Grid Search.

Parameters:
  • objective_fcn (Callable[[Dict], float]) – The objective function to be optimized.

  • parameters (dict) – The parameter dictionary that specifies the types and ranges to optimize.

Returns:

The best hyperparameters found during tuning.

Return type:

Dict[str, Any]

class prt_rl.common.tuners.HyperparameterTuner[source]#

Abstract base class for implementing hyperparameter tuners.

abstractmethod tune(objective_fcn: Callable[[Dict], float], parameters: dict) Dict[str, Any][source]#

Tune the hyperparameters of the given objective function. :param objective_fcn: The objective function to be optimized. :type objective_fcn: Callable[[Dict], float] :param parameters: The parameter dictionary that specifies the types and ranges to optimize. :type parameters: dict

Returns:

The best hyperparameters found during tuning.

Return type:

Dict[str, Any]

class prt_rl.common.tuners.OptunaTuner(total_trials: int, maximize: bool = True, num_jobs: int = -1)[source]#

Hyperparameter tuning using Optuna.

Parameters:
  • total_trials (int) – The number of trials to run.

  • maximize (bool) – Whether to maximize the objective function. Default is True.

  • num_jobs (int) – The number of parallel jobs to run. Default is -1 (use all available cores).

Example

tune(objective_fcn: Callable, parameters: dict) Dict[str, Any][source]#

Tune the hyperparameters of the given model using Optuna.

Parameters:
  • objective_fcn (Callable[[Dict], float]) – The objective function to be optimized.

  • parameters (dict) – The parameter dictionary that specifies the types and ranges to optimize.

Returns:

The best hyperparameters found during tuning.

Return type:

Dict[str, Any]