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

Method run

codeclash/analysis/metrics/elo.py:1031–1059  ·  view source on GitHub ↗

Calculate Elo for max rounds from 1 to max_rounds and plot the results.

(self)

Source from the content-addressed store, hash-verified

1029 self.score_type = score_type
1030 self.regularization = regularization
1031 self.output_dir = output_dir
1032 self.games = games
1033
1034 @staticmethod
1035 def _save_plot(output_dir: Path, filename_base: str) -> None:
1036 """Save plot in both PDF and PNG formats."""
1037 for fmt in ["pdf", "png"]:
1038 output_path = output_dir / f"{filename_base}.{fmt}"
1039 plt.savefig(output_path, format=fmt, bbox_inches="tight", dpi=300 if fmt == "png" else None)
1040 logger.info(f"Saved plot: {output_path}")
1041
1042 def run(self) -> None:
1043 """Calculate Elo for max rounds from 1 to max_rounds and plot the results."""
1044 logger.info(f"Calculating Elo for max rounds 1 to {self.max_rounds}")
1045
1046 # Dictionary to store results: {max_round: {game_name: {player: elo}}}
1047 results_by_max_round: dict[int, dict[str, dict[str, float]]] = {}
1048
1049 for max_round in tqdm(range(1, self.max_rounds + 1), desc="Processing max rounds"):
1050 builder = ScoreMatrixBuilder(
1051 all_games_normalization_scheme=self.all_games_normalization_scheme,
1052 score_type=self.score_type,
1053 max_round=max_round,
1054 )
1055 builder.build(self.log_dir)
1056
1057 results_by_max_round[max_round] = {}
1058
1059 for game_name, matchups in builder.win_matrix.items():
1060 if self.games is not None and game_name not in self.games:
1061 continue
1062

Callers 1

elo.pyFile · 0.45

Calls 6

buildMethod · 0.95
fitMethod · 0.95
_plot_resultsMethod · 0.95
ScoreMatrixBuilderClass · 0.85
BradleyTerryFitterClass · 0.85
bt_to_eloMethod · 0.45

Tested by

no test coverage detected