Skip to content

Commit

Permalink
also dump pareto front
Browse files Browse the repository at this point in the history
  • Loading branch information
enarjord committed Nov 7, 2024
1 parent c0b629d commit edb1a46
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tools/extract_best_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ def process_single(file_location, verbose=False):
print_("n candidates", len(candidates))
if len(candidates) == 1:
best = candidates.iloc[0].name
pareto = candidates
else:
pareto = candidates.loc[
calc_pareto_front_d(
{i: x for i, x in zip(candidates.index, candidates.values)}, higher_is_better
)
]

cands_norm = (candidates - candidates.min()) / (candidates.max() - candidates.min())
pareto_norm = (pareto - candidates.min()) / (candidates.max() - candidates.min())
dists = [calc_dist(p, [float(x) for x in higher_is_better]) for p in pareto_norm.values]
Expand Down Expand Up @@ -185,6 +185,10 @@ def process_single(file_location, verbose=False):
full_path = file_location.replace("_all_results.txt", "") + ".json"
base_path = os.path.split(full_path)[0]
full_path = make_get_filepath(full_path.replace(base_path, base_path + "_analysis/"))
pareto_to_dump = [x for i, x in enumerate(xs) if i in pareto.index]
with open(full_path.replace(".json", "_pareto.txt"), "w") as f:
for x in pareto_to_dump:
f.write(json.dumps(x) + "\n")
dump_config(format_config(best_d), full_path)
return best_d

Expand Down

0 comments on commit edb1a46

Please sign in to comment.