Skip to content

Commit

Permalink
fix: fix round in pass@k metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
andre15silva committed Aug 16, 2024
1 parent 7351c0b commit 816917a
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions evaluate_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,26 +161,38 @@ def compute_statistics(samples: list) -> dict:

# geometric progression over k
for k in [1, 10, 100]:
if k < statistics["num_bugs_with_prompt"]:
statistics[f"exact_match@{k}"] = pass_at_k(
statistics["num_patches"],
statistics["num_exact_match_patches"],
k,
if k < (statistics["num_patches"] // statistics["num_bugs_with_candidates"]):
statistics[f"exact_match@{k}"] = round(
pass_at_k(
statistics["num_patches"],
statistics["num_exact_match_patches"],
k,
),
3,
)
statistics[f"ast_match@{k}"] = pass_at_k(
statistics["num_patches"],
statistics["num_ast_match_patches"],
k,
statistics[f"ast_match@{k}"] = round(
pass_at_k(
statistics["num_patches"],
statistics["num_ast_match_patches"],
k,
),
3,
)
statistics[f"plausible@{k}"] = pass_at_k(
statistics["num_patches"],
statistics["num_plausible_patches"],
k,
statistics[f"plausible@{k}"] = round(
pass_at_k(
statistics["num_patches"],
statistics["num_plausible_patches"],
k,
),
3,
)
statistics[f"compilable@{k}"] = pass_at_k(
statistics["num_patches"],
statistics["num_compilable_patches"],
k,
statistics[f"compilable@{k}"] = round(
pass_at_k(
statistics["num_patches"],
statistics["num_compilable_patches"],
k,
),
3,
)

statistics["bugs_with_exact_match_candidates"].sort()
Expand Down

0 comments on commit 816917a

Please sign in to comment.