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

Method run

codeclash/analysis/metrics/elo.py:1147–1176  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

1145 self.score_type = score_type
1146 self.regularization = regularization
1147 self.output_dir = output_dir
1148 self.games = games
1149
1150 @staticmethod
1151 def _save_plot(output_dir: Path, filename_base: str) -> None:
1152 """Save plot in both PDF and PNG formats."""
1153 for fmt in ["pdf", "png"]:
1154 output_path = output_dir / f"{filename_base}.{fmt}"
1155 plt.savefig(output_path, format=fmt, bbox_inches="tight", dpi=300 if fmt == "png" else None)
1156 logger.info(f"Saved plot: {output_path}")
1157
1158 def run(self) -> None:
1159 """Calculate Elo for only specific rounds from 1 to max_rounds and plot the results."""
1160 logger.info(f"Calculating Elo for only specific rounds 1 to {self.max_rounds}")
1161
1162 # Dictionary to store results: {round: {game_name: {player: elo}}}
1163 results_by_round: dict[int, dict[str, dict[str, float]]] = {}
1164
1165 for round_num in tqdm(range(1, self.max_rounds + 1), desc="Processing specific rounds"):
1166 builder = ScoreMatrixBuilder(
1167 all_games_normalization_scheme=self.all_games_normalization_scheme,
1168 score_type=self.score_type,
1169 max_round=round_num,
1170 only_specific_round=True,
1171 )
1172 builder.build(self.log_dir)
1173
1174 results_by_round[round_num] = {}
1175
1176 for game_name, matchups in builder.win_matrix.items():
1177 if self.games is not None and game_name not in self.games:
1178 continue
1179

Callers

nothing calls this directly

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