trials = study.trials
if len(trials) == 0:
logger.warning("Study instance does not contain trials.")
return go.Figure(data=[], layout=layout)
if hasattr(trials[0], "intermediate_values") is False:
logger.warning(
"You need to set up the pruning feature to utilize plot_intermediate_values()")
return go.Figure(data=[], layout=layout)
target_state = [TrialState.PRUNED, TrialState.COMPLETE, TrialState.RUNNING]
trials = [trial for trial in trials if trial.state in target_state]
traces = []
for trial in trials:
trace = go.Scatter(
x=tuple(trial.intermediate_values.keys()),
y=tuple(trial.intermediate_values.values()),
mode="lines+markers",
marker={