Skip to content

Commit

Permalink
[fix] [refactor] Fix the SMAC requirement and refactor some conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
nabenabe0928 committed Jan 27, 2022
1 parent c216ef0 commit 1a76b82
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions autoPyTorch/evaluation/tae.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,19 @@ def run_wrapper(
RunValue:
Contains information about the status/performance of config
"""
is_intensified = (run_info.budget != 0) # SMAC returns non-zero budget for intensification
# SMAC returns non-zero budget for intensification
# In other words, SMAC returns budget=0 for a simple intensifier (i.e. no intensification)
is_intensified = (run_info.budget != 0)
default_budget = self._check_and_get_default_budget()

if self.budget_type is None:
if is_intensified:
raise ValueError(
f'budget must be 0 (no intensification) for budget_type=None, but got {run_info.budget}'
)
else:
if not is_intensified: # SMAC returns budget=0 for a simple intensifier (no intensification)
run_info = run_info._replace(budget=default_budget)
elif run_info.budget < 0:
raise ValueError(f'budget must be greater than zero but got {run_info.budget}')
if self.budget_type is None and is_intensified:
raise ValueError(f'budget must be 0 (=no intensification) for budget_type=None, but got {run_info.budget}')
if self.budget_type is not None and run_info.budget < 0:
raise ValueError(f'budget must be greater than zero but got {run_info.budget}')

if self.budget_type is not None and not is_intensified:
# The budget will be provided in train evaluator when budget_type is None
run_info = run_info._replace(budget=default_budget)

remaining_time = self.stats.get_remaing_time_budget()

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ imgaug>=0.4.0
ConfigSpace>=0.4.14,<0.5
pynisher>=0.6.3
pyrfr>=0.7,<0.9
smac==0.14.0
smac>=0.14.0
dask
distributed>=2.2.0
catboost
Expand Down

0 comments on commit 1a76b82

Please sign in to comment.