Skip to content

Commit

Permalink
fix(download): Path naming for surrogate models
Browse files Browse the repository at this point in the history
Minor other changes:
* Clip metrics from surrogates
* Reduce minimum fidelity to 1
  • Loading branch information
eddiebergman authored May 10, 2024
2 parents 63c2bee + 0cf2506 commit 342edf2
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/mfpbench/jahs/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class JAHSResult(Result[JAHSConfig, int]):

class JAHSBenchmark(Benchmark[JAHSConfig, JAHSResult, int], ABC):
JAHS_FIDELITY_NAME: ClassVar[str] = "epoch"
JAHS_FIDELITY_RANGE: ClassVar[tuple[int, int, int]] = (3, 200, 1)
JAHS_FIDELITY_RANGE: ClassVar[tuple[int, int, int]] = (1, 200, 1)
JAHS_METRICS_TO_ACTIVATE: ClassVar[tuple[str, ...]] = (
"valid-acc",
"test-acc",
Expand Down Expand Up @@ -198,7 +198,7 @@ def bench(self) -> jahs_bench.Benchmark:
)

self._bench = jahs_bench.Benchmark(
task=self.task_id,
task=task,
save_dir=self.datadir,
download=False,
metrics=self.JAHS_METRICS_TO_ACTIVATE,
Expand Down
3 changes: 2 additions & 1 deletion src/mfpbench/pd1/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ def _results_for(
features = xs.columns
for metric, surrogate in self.surrogates.items():
# We clip as sometimes the surrogate produces negative values
xs[metric] = surrogate.predict(xs[features]).clip(min=0)
bounds = self.Result.metric_defs[metric].bounds
xs[metric] = surrogate.predict(xs[features]).clip(*bounds)

metrics = list(self.surrogates.keys())
return [dict(r[metrics]) for _, r in xs.iterrows()]
Expand Down
4 changes: 2 additions & 2 deletions src/mfpbench/pd1/benchmarks/cifar100.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@


class PD1cifar100_wideresnet_2048(PD1Benchmark):
pd1_fidelity_range = (45, 199, 1)
pd1_fidelity_range = (1, 199, 1)
pd1_result_type = PD1ResultTransformer
pd1_name = "cifar100-wideresnet-2048"
pd1_name = "cifar100-wide_resnet-2048"

@classmethod
def _create_space(cls, seed: int | None = None) -> ConfigurationSpace:
Expand Down
2 changes: 1 addition & 1 deletion src/mfpbench/pd1/benchmarks/imagenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class PD1imagenet_resnet_512(PD1Benchmark):
pd1_result_type = PD1ResultTransformer
pd1_fidelity_range = (3, 99, 1)
pd1_fidelity_range = (1, 99, 1)
pd1_name = "imagenet-resnet-512"

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion src/mfpbench/pd1/benchmarks/translate_wmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class PD1translatewmt_xformer_64(PD1Benchmark):
pd1_fidelity_range = (1, 19, 1)
pd1_result_type = PD1ResultTransformer
pd1_name = "translate-wmt-xformer-64"
pd1_name = "translate_wmt-xformer_translate-64"

@classmethod
def _create_space(cls, seed: int | None = None) -> ConfigurationSpace:
Expand Down
2 changes: 1 addition & 1 deletion src/mfpbench/synthetic/hartmann/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def __init__(
config_type=self.mfh_config_type,
result_type=self.mfh_result_type,
fidelity_name="z",
fidelity_range=(3, _max_fidelity, 1),
fidelity_range=(1, _max_fidelity, 1),
space=space,
seed=seed,
prior=prior,
Expand Down

0 comments on commit 342edf2

Please sign in to comment.