finol.optimization_layer.ParametersTuner

class finol.optimization_layer.ParametersTuner(load_dataset_output)[source]

Class to tune model hyper-parameters using auto ML library.

Parameters:

load_dataset_output

Example

>>> # Load dataset
>>> from finol.data_layer.dataset_loader import DatasetLoader
>>> load_dataset_output = DatasetLoader().load_dataset()
>>>
>>> # Tune model
>>> ParametersTuner(load_dataset_output=load_dataset_output).tune_parameters()

Methods

objective(trial)

Objective function for Optuna optimization.

sample_params(trial)

Samples model hyper-parameters for optimization.

select_pruner()

Selects and initializes an Optuna pruner based on the configuration.

select_sampler()

Selects and initializes an Optuna sampler based on the configuration.

tune_parameters()

Tune model hyper-parameters.

objective(trial)[source]

Objective function for Optuna optimization. Trains the model using the sampled parameters and returns the validation loss.

Parameters:

trial (Trial) – Optuna Trial object.

Returns:

Validation loss.

Return type:

float

sample_params(trial)[source]

Samples model hyper-parameters for optimization.

Parameters:

trial (Trial) – Optuna Trial object to sample the parameters.

Returns:

None

Return type:

None

select_pruner()[source]

Selects and initializes an Optuna pruner based on the configuration.

Returns:

Initialized Optuna pruner object.

Return type:

object

select_sampler()[source]

Selects and initializes an Optuna sampler based on the configuration.

Returns:

Initialized Optuna sampler object.

Return type:

object

tune_parameters()[source]

Tune model hyper-parameters.

This method creates an Optuna study object, optimizes the objective function, visualizes the results, and prints out the optimization results.

Returns:

None

Return type:

None