Optuna

neptunecontrib.monitoring.optuna.NeptuneMonitor(experiment=None)[source]

Logs hyperparameter optimization process to Neptune.

Parameters:experiment (neptune.experiments.Experiment) – Neptune experiment. Default is None.

Examples

Initialize neptune_monitor:

import neptune
import neptunecontrib.monitoring.optuna as opt_utils

neptune.init(project_qualified_name='USER_NAME/PROJECT_NAME')
neptune.create_experiment(name='optuna sweep')

monitor = opt_utils.NeptuneMonitor()

Run Optuna training passing monitor as callback:

...
study = optuna.create_study(direction='maximize')
study.optimize(objective, n_trials=100, callbacks=[monitor])

You can explore an example experiment in Neptune https://ui.neptune.ai/jakub-czakon/blog-hpo/e/BLOG-404/charts

neptunecontrib.monitoring.optuna.log_study(study, experiment=None)[source]

Logs runs results and parameters to neptune. Logs all hyperparameter optimization results to Neptune. Those include best score (‘best_score’ channel), best parameters (‘best_parameters’ property), and the study object itself.

Parameters:
  • results ('optuna.study.Study') – Optuna study object after training is completed.
  • experiment (neptune.experiments.Experiment) – Neptune experiment. Default is None.

Examples

Initialize neptune_monitor:

import neptune
import neptunecontrib.monitoring.optuna as opt_utils

neptune.init(project_qualified_name='USER_NAME/PROJECT_NAME')
neptune.create_experiment(name='optuna sweep')

monitor = opt_utils.NeptuneMonitor()

Run Optuna training passing monitor as callback:

...
study = optuna.create_study(direction='maximize')
study.optimize(objective, n_trials=100, callbacks=[monitor])
opt_utils.log_study(study)

You can explore an example experiment in Neptune https://ui.neptune.ai/jakub-czakon/blog-hpo/e/BLOG-404/charts