Skip to content

Commit

Permalink
Fix buf for random when selecting the on-disk cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Semmler committed Jan 10, 2024
1 parent a182325 commit de69310
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
14 changes: 9 additions & 5 deletions scripts/calculate_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ def _calculate_values(
)

params = load_params_fast()
cache_group = params["valuation_methods"][valuation_method_name]["cache_group"]
cache_backend = DiskCacheBackend(
Path(".cache") / experiment_name / dataset_name / model_name / cache_group
)

cache = None
if "cache_group" in params["valuation_methods"][valuation_method_name]:
cache_group = params["valuation_methods"][valuation_method_name]["cache_group"]
cache = DiskCacheBackend(
Path(".cache") / experiment_name / dataset_name / model_name / cache_group
)

val_set = Accessor.datasets(experiment_name, dataset_name).loc[0, "val_set"]

n_pipeline_step = 4
Expand All @@ -119,7 +123,7 @@ def _calculate_values(
model=model,
scorer=Scorer("accuracy", default=0.0),
catch_errors=True,
cache_backend=cache_backend,
cache_backend=cache,
),
valuation_method=algorithm_name,
n_jobs=n_jobs,
Expand Down
5 changes: 4 additions & 1 deletion scripts/evaluate_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ def _evaluate_metrics(
seed = pipeline_seed(repetition_id, n_pipeline_step)

cache = None
if "eval_model" in metric_kwargs:
if (
"eval_model" in metric_kwargs
and "cache_group" in params["valuation_methods"][valuation_method_name]
):
cache_group = params["valuation_methods"][valuation_method_name]["cache_group"]
cache = DiskCacheBackend(
Path(".cache")
Expand Down

0 comments on commit de69310

Please sign in to comment.