Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Error Checking for Optuna Integration (#217)
Browse files Browse the repository at this point in the history
* Error Checking for Optuna Integration

Skips over interrupted trials

* Optuna Trials from Completed Trials
  • Loading branch information
GoldenCorgi authored Oct 26, 2021
1 parent 4bd678e commit eaa37fc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hiplot/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,10 +515,13 @@ def from_optuna(study: "optuna.study.Study") -> "Experiment": # No type hint to

# Create a list of dictionary objects using study trials
# All parameters are taken using params.copy()

import optuna

hyper_opt_data = []
for each_trial in study.trials:
for each_trial in study.get_trials(states=(optuna.trial.TrialState.COMPLETE, )):
trial_params = {}
if not each_trial.values: # This checks if the trial was fully completed - the value will be None if the trial was interrupted halfway (e.g. via KeyboardInterrupt)
continue
num_objectives = len(each_trial.values)

if num_objectives == 1:
Expand Down

0 comments on commit eaa37fc

Please sign in to comment.