Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Load data benchmark results #135

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion benchmarks/results/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ def process():
filter_params = ["tol", "seed", "max_epochs", "lr", "batch_size"]

data = {}

# Load existing data
try:
with open("results/data.json", "r") as f:
data = json.load(f)
except FileNotFoundError:
pass

benchmarks = sorted(df["benchmark"].unique())
for bm in benchmarks:
data[bm] = []
if bm not in data:
data[bm] = []

df_benchmark = df[df["benchmark"] == bm]
operators = sorted(df_benchmark["operator"].unique())
Expand All @@ -40,6 +49,22 @@ def process():
# Get the best operator run for this benchmark
best = operator_data.sort_values("loss/test").iloc[0].to_dict()

# Check if the operator already exists with a better loss
existing_operators = [v["operator"] for v in data[bm]]
if operator in existing_operators:
old_best_value = float(
[v["loss/test"] for v in data[bm] if v["operator"] == operator][0]
)
if best["loss/test"] >= old_best_value:
print(
f"Skipping {bm} {operator} because it has a better loss already: "
f"old={old_best_value:.4e} new={best['loss/test']:.4e}"
)
continue
else:
# Remove the old operator
data[bm] = [v for v in data[bm] if v["operator"] != operator]

# Filter out parameters
best["params"] = {
k: v for k, v in best["params"].items() if k not in filter_params
Expand Down
Loading