MCPcopy
hub / github.com/optuna/optuna / _create_study

Function _create_study

tests/visualization_tests/test_timeline.py:40–56  ·  view source on GitHub ↗
(
    trial_states: list[TrialState],
    trial_sys_attrs: dict[str, Any] | None = None,
)

Source from the content-addressed store, hash-verified

38
39
40def _create_study(
41 trial_states: list[TrialState],
42 trial_sys_attrs: dict[str, Any] | None = None,
43) -> Study:
44 study = optuna.create_study()
45 fmax = float(len(trial_states))
46 for i, s in enumerate(trial_states):
47 study.add_trial(
48 optuna.trial.create_trial(
49 params={"x": float(i)},
50 distributions={"x": optuna.distributions.FloatDistribution(-1.0, fmax)},
51 value=0.0 if s == TrialState.COMPLETE else None,
52 state=s,
53 system_attrs=trial_sys_attrs,
54 )
55 )
56 return study
57
58
59def _create_study_negative_elapsed_time() -> Study:

Calls 1

add_trialMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…