mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-08-20 12:40:54 +08:00
fix by review
This commit is contained in:
@@ -44,6 +44,7 @@ Preferential Optimization
|
||||
optuna_dashboard.preferential.create_study
|
||||
optuna_dashboard.preferential.load_study
|
||||
optuna_dashboard.preferential.PreferentialStudy
|
||||
optuna_dashboard._prefential_setting.register_preference_feedback_component
|
||||
|
||||
Streamlit
|
||||
-----------------
|
||||
|
||||
@@ -28,7 +28,7 @@ from ._cached_extra_study_property import get_cached_extra_study_property
|
||||
from ._custom_plot_data import get_plotly_graph_objects
|
||||
from ._importance import get_param_importance_from_trials_cache
|
||||
from ._pareto_front import get_pareto_front_trials
|
||||
from ._preference_setting import _register_preference_feedback_component_type
|
||||
from ._preference_setting import _register_preference_feedback_component
|
||||
from ._preferential_history import NewHistory
|
||||
from ._preferential_history import PreferenceHistoryNotFound
|
||||
from ._preferential_history import remove_history
|
||||
@@ -323,7 +323,7 @@ def create_app(
|
||||
response.status = 400
|
||||
return {"reason": "component_type must be either 'Note' or 'Artifact'."}
|
||||
|
||||
_register_preference_feedback_component_type(
|
||||
_register_preference_feedback_component(
|
||||
study_id=study_id,
|
||||
storage=storage,
|
||||
component_type=component_type,
|
||||
|
||||
@@ -16,7 +16,7 @@ if TYPE_CHECKING:
|
||||
_SYSTEM_ATTR_FEEDBACK_COMPONENT = "preference:component"
|
||||
|
||||
|
||||
def _register_preference_feedback_component_type(
|
||||
def _register_preference_feedback_component(
|
||||
study_id: int,
|
||||
storage: BaseStorage,
|
||||
component_type: OUTPUT_COMPONENT_TYPE,
|
||||
@@ -59,7 +59,7 @@ def register_preference_feedback_component(
|
||||
artifact_key is not None
|
||||
), "artifact_key must be specified when component_type is Artifact"
|
||||
|
||||
_register_preference_feedback_component_type(
|
||||
_register_preference_feedback_component(
|
||||
study_id=study._study._study_id,
|
||||
storage=study._study._storage,
|
||||
component_type=component_type,
|
||||
|
||||
@@ -8,7 +8,7 @@ from optuna import get_all_study_summaries
|
||||
from optuna.study import StudyDirection
|
||||
from optuna_dashboard._app import create_app
|
||||
from optuna_dashboard._app import create_new_study
|
||||
from optuna_dashboard._preference_setting import register_preference_feedback_component_type
|
||||
from optuna_dashboard._preference_setting import register_preference_feedback_component
|
||||
from optuna_dashboard._preferential_history import NewHistory
|
||||
from optuna_dashboard._preferential_history import remove_history
|
||||
from optuna_dashboard._preferential_history import report_history
|
||||
@@ -187,7 +187,7 @@ class APITestCase(TestCase):
|
||||
def test_change_component(self) -> None:
|
||||
storage = optuna.storages.InMemoryStorage()
|
||||
study = create_study(storage=storage, n_generate=3)
|
||||
register_preference_feedback_component_type(study, "note")
|
||||
register_preference_feedback_component(study, "note")
|
||||
for _ in range(3):
|
||||
study.ask()
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@ from unittest import TestCase
|
||||
|
||||
import optuna
|
||||
from optuna_dashboard._preference_setting import _SYSTEM_ATTR_FEEDBACK_COMPONENT
|
||||
from optuna_dashboard._preference_setting import register_preference_feedback_component_type
|
||||
from optuna_dashboard._preference_setting import register_preference_feedback_component
|
||||
from optuna_dashboard.preferential._study import PreferentialStudy
|
||||
|
||||
|
||||
class FeedbackSettingTestCase(TestCase):
|
||||
def test_widget_to_dict_from_dict(self) -> None:
|
||||
study = PreferentialStudy(optuna.create_study())
|
||||
register_preference_feedback_component_type(study, "artifact", "image_key")
|
||||
register_preference_feedback_component(study, "artifact", "image_key")
|
||||
system_attrs = study._study.system_attrs
|
||||
feedback_type = system_attrs.get(_SYSTEM_ATTR_FEEDBACK_COMPONENT, {})
|
||||
assert "type" in feedback_type
|
||||
|
||||
Reference in New Issue
Block a user