mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-11 12:30:25 +08:00
format
This commit is contained in:
@@ -20,8 +20,6 @@ artifact_path = os.path.join(os.path.dirname(__file__), "artifact")
|
||||
artifact_backend = FileSystemBackend(base_path=artifact_path)
|
||||
os.makedirs(artifact_path, exist_ok=True)
|
||||
|
||||
n_comparison = 5
|
||||
|
||||
|
||||
def main() -> NoReturn:
|
||||
study = create_study(
|
||||
@@ -35,7 +33,7 @@ def main() -> NoReturn:
|
||||
while True:
|
||||
# If n_comparison "best" trials (that are not reported bad) exists,
|
||||
# the generator waits for human evaluation.
|
||||
if study.should_generate():
|
||||
if not study.should_generate():
|
||||
time.sleep(0.1) # Avoid busy-loop
|
||||
continue
|
||||
|
||||
|
||||
@@ -280,8 +280,8 @@ class PreferentialStudy:
|
||||
|
||||
Returns :obj:`True` if the number of trials not reported bad and not skipped are less than
|
||||
:attr:`~optuna_dashboard.preferential.PreferentialStudy.n_generate`. Users are recommended
|
||||
to generate a new trial if this method returns :obj:`True`, and to wait for human evaluation
|
||||
if this method returns :obj:`False`.
|
||||
to generate a new trial if this method returns :obj:`True`, and to wait for human
|
||||
evaluation if this method returns :obj:`False`.
|
||||
"""
|
||||
return len(self.best_trials) < self.n_generate
|
||||
|
||||
@@ -360,9 +360,7 @@ def create_study(
|
||||
study._storage.set_study_system_attr(
|
||||
study._study_id, _SYSTEM_ATTR_PREFERENTIAL_STUDY, True
|
||||
)
|
||||
study._storage.set_study_system_attr(
|
||||
study._study_id, _SYSTEM_ATTR_N_GENERATE, 4 # Default n_generate is 4
|
||||
)
|
||||
set_n_generate(study._study_id, study._storage, 4) # Default n_generate
|
||||
return PreferentialStudy(study)
|
||||
|
||||
except optuna.exceptions.DuplicatedStudyError:
|
||||
|
||||
@@ -67,7 +67,7 @@ def get_n_generate(study_system_attrs: dict[str, Any]) -> int:
|
||||
return study_system_attrs[_SYSTEM_ATTR_N_GENERATE]
|
||||
|
||||
|
||||
def set_n_generate(study_id: int, n_generate: int, storage: BaseStorage) -> None:
|
||||
def set_n_generate(study_id: int, storage: BaseStorage, n_generate: int) -> None:
|
||||
storage.set_study_system_attr(
|
||||
study_id=study_id,
|
||||
key=_SYSTEM_ATTR_N_GENERATE,
|
||||
|
||||
Reference in New Issue
Block a user