optuna / optuna-dashboard

Real-time Web Dashboard for Optuna.
https://optuna-dashboard.readthedocs.io/en/latest/
Other
477 stars 83 forks source link

Fix best trial history for pruned trials #852

Closed not522 closed 3 months ago

not522 commented 3 months ago

Contributor License Agreement

This repository (optuna-dashboard) and Goptuna share common code. This pull request may therefore be ported to Goptuna. Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.

Reference Issues/PRs

What does this implement/fix? Explain your changes.

Pruned trials are incorrectly included in the best trials. For example, the second trial in the study below becomes the best.

import optuna

study = optuna.create_study(study_name="tmp", storage="sqlite:///tmp.db")
trial = study.ask()
study.tell(trial, 1)
trial = study.ask()
trial.report(step=0, value=0)
study.tell(trial, state=optuna.trial.TrialState.PRUNED)
codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 69.51%. Comparing base (978695b) to head (4f76b8a). Report is 3 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #852 +/- ## ======================================= Coverage 69.51% 69.51% ======================================= Files 35 35 Lines 2375 2375 ======================================= Hits 1651 1651 Misses 724 724 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.