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

Method __init__

codeclash/analysis/metrics/elo.py:314–332  ·  view source on GitHub ↗

Fit Bradley-Terry model to a win matrix Args: win_matrix: Dictionary mapping player pairs to win counts regularization: L2 regularization strength compute_uncertainties: Whether to compute uncertainties

(
        self,
        win_matrix: dict[tuple[str, str], list[float]],
        *,
        regularization: float = 0.01,
        compute_uncertainties: bool = True,
    )

Source from the content-addressed store, hash-verified

312 return boot_matrix
313
314 def print_matrix(self) -> None:
315 for game, matchups in sorted(self.win_matrix.items()):
316 print(f"\n{game}:")
317 for (p1, p2), (w1, w2) in sorted(matchups.items()):
318 if game == "ALL":
319 print(f" {p1} vs {p2}: {w1:.3f}-{w2:.3f}")
320 else:
321 print(f" {p1} vs {p2}: {w1:.0f}-{w2:.0f}")
322
323
324class BradleyTerryFitter:
325 def __init__(
326 self,
327 win_matrix: dict[tuple[str, str], list[float]],
328 *,
329 regularization: float = 0.01,
330 compute_uncertainties: bool = True,
331 ):
332 """Fit Bradley-Terry model to a win matrix
333
334 Args:
335 win_matrix: Dictionary mapping player pairs to win counts

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected