MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / write_bootstrap_metrics_table

Function write_bootstrap_metrics_table

codeclash/analysis/metrics/elo.py:1429–1467  ·  view source on GitHub ↗

Write LaTeX table comparing bootstrap metrics between methods. Args: bootstrap_results: Dictionary mapping bootstrap type to metrics dict output_dir: Directory to save the LaTeX file game: Game name for the table caption

(bootstrap_results: dict[str, dict], output_dir: Path, game: str = "ALL")

Source from the content-addressed store, hash-verified

1427
1428 leaderboard[game_name.lower()] = {
1429 "board": board,
1430 "last_updated": datetime.utcnow().isoformat() + "Z",
1431 }
1432
1433 # Write to file
1434 with open(output_file, "w") as f:
1435 json.dump(leaderboard, f, indent=2)
1436
1437 logger.info(f"Saved leaderboard JSON: {output_file}")
1438
1439
1440def write_bootstrap_metrics_table(bootstrap_results: dict[str, dict], output_dir: Path, game: str = "ALL") -> None:
1441 """Write LaTeX table comparing bootstrap metrics between methods.
1442
1443 Args:
1444 bootstrap_results: Dictionary mapping bootstrap type to metrics dict
1445 output_dir: Directory to save the LaTeX file
1446 game: Game name for the table caption
1447 """
1448 output_dir.mkdir(parents=True, exist_ok=True)
1449 output_file = output_dir / "bootstrap_metrics.tex"
1450
1451 lines = []
1452 lines.append(r"\begin{tabular}{lcc}")
1453 lines.append(r"\toprule")
1454 lines.append(r"Metric & Nonparametric & Parametric \\")
1455 lines.append(r"\midrule")
1456
1457 if "nonparametric" in bootstrap_results and "parametric" in bootstrap_results:
1458 nonparam = bootstrap_results["nonparametric"]
1459 param = bootstrap_results["parametric"]
1460
1461 metrics = [
1462 ("Kendall's $\\tau$", "kendall_tau"),
1463 ("Spearman's $\\rho$", "spearman_rho"),
1464 ("Footrule (normalized)", "footrule"),
1465 ("Top-1 consistency", "top1_consistency"),
1466 ("Pairwise order agreement", "pairwise_agreement"),
1467 ]
1468
1469 for display_name, key in metrics:
1470 nonparam_val = nonparam.get(key, float("nan"))

Callers 1

elo.pyFile · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected