Skip to content

Commit

Permalink
pre commit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dengdifan committed Nov 7, 2024
1 parent 1ce78f3 commit 55c6b57
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions package/samplers/smac_sampler/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from optuna.distributions import CategoricalDistribution
from optuna.distributions import FloatDistribution
from optuna.distributions import IntDistribution
from optuna.study import Study, StudyDirection
from optuna.study import Study
from optuna.study import StudyDirection
from optuna.trial import FrozenTrial
from optuna.trial import TrialState
import optunahub
Expand Down Expand Up @@ -191,7 +192,10 @@ def after_trial(
cfg_params[name] = hp_value

# params to smac HP, in SMAC, we always do the minimization
values_to_minimize = [v if d == StudyDirection.MINIMIZE else -v for d, v in zip(study.directions, values)]
values_to_minimize = [
v if d == StudyDirection.MINIMIZE else -v
for d, v in zip(study.directions, values) # type: ignore
]
y = np.asarray(values_to_minimize)
if state == TrialState.COMPLETE:
status = StatusType.SUCCESS
Expand Down

0 comments on commit 55c6b57

Please sign in to comment.