Hyper Parameter Optimizer

The class encapsulates all necessary components for conducting an extensive search over a predefined hyperparameter space, handling the iterative trial-and-error process automatically and recording the outcomes for analysis. The optimization process aims either to maximize or minimize a given metric, depending on the user’s requirements and the nature of the QSAR problem being addressed.

class qsar.utils.hyperparameter_optimizer.HyperParameterOptimizer(model: BaselineModel, data, trials=1000, direction='maximize')

Bases: object

A class for optimizing hyperparameters of a given model using Optuna.

This optimizer handles the process of finding the best hyperparameters for a model, using the Optuna library for efficient optimization. It is designed to work with models that inherit from the ‘Model’ class and implement an ‘optimize_hyperparameters’ method.

Variables:
  • DEFAULT_TRIALS (int) – Default number of trials for optimization (class attribute).

  • model (Model) – Model instance to be optimized.

  • data – Training data on which the optimization is performed.

  • trials (int) – Number of optimization trials.

  • direction (str) – Direction for optimization, either ‘maximize’ or ‘minimize’.

DEFAULT_TRIALS = 1000
optimize() Study

Perform hyperparameter optimization.

Returns:

The optuna study object containing the results of the optimization.

Return type:

optuna.study.Study