optuna_dashboard.register_objective_form_widgets

optuna_dashboard.register_objective_form_widgets(study, widgets)

Register a list of form widgets to an Optuna study.

Submitted values to the forms are told as each trial’s objective values.

Parameters:
Raises:
  • ValueError – If the length of study directions is not equal to the length of widgets.

  • Warning – If any widget has user_attr_key specified, but it will not be used.

Return type:

None

Examples

import optuna
from optuna_dashboard import ChoiceWidget, SliderWidget
from optuna_dashboard import register_objective_form_widgets


study = optuna.create_study()
register_objective_form_widgets(
    study,
    widgets=[
        ObjectiveChoiceWidget(
            choices=["Good 👍", "Bad 👎"],
            values=[-1, 1],
            description="Please input your score!",
        ),
        ObjectiveSliderWidget(
            min=1,
            max=10,
            step=1,
            description="Higher is better.",
        ),
    ],
)