Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 1, 2024
1 parent ba69203 commit 8932d9f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions optimas/generators/ax/developer/multitask.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from ax.core.observation import ObservationFeatures
from ax.core.generator_run import GeneratorRun
from ax.storage.json_store.save import save_experiment

try:
from ax.storage.metric_registry import register_metric as register_metrics
except ImportError:
Expand Down Expand Up @@ -51,8 +52,11 @@
from ax.modelbridge.registry import Models, MT_MTGP_trans
from ax.core.experiment import Experiment
from ax.core.data import Data
from ax.modelbridge.transforms.convert_metric_names import tconfig_from_mt_experiment
from ax.modelbridge.transforms.convert_metric_names import (
tconfig_from_mt_experiment,
)
from ax.utils.common.typeutils import checked_cast

# This function is from https://ax.dev/tutorials/multi_task.html#4b.-Multi-task-Bayesian-optimization
def get_MTGP(
experiment: Experiment,
Expand All @@ -70,7 +74,9 @@ def get_MTGP(
}
transforms = MT_MTGP_trans
transform_configs = {
"TrialAsTask": {"trial_level_map": {"trial_type": trial_index_to_type}},
"TrialAsTask": {
"trial_level_map": {"trial_type": trial_index_to_type}
},
"ConvertMetricNames": tconfig_from_mt_experiment(experiment),
}

Expand All @@ -80,7 +86,9 @@ def get_MTGP(
if trial_index is None:
trial_index = len(experiment.trials) - 1
elif trial_index >= len(experiment.trials):
raise ValueError("trial_index is bigger than the number of experiment trials")
raise ValueError(
"trial_index is bigger than the number of experiment trials"
)

status_quo = experiment.trials[trial_index].status_quo
if status_quo is None:
Expand Down

0 comments on commit 8932d9f

Please sign in to comment.