MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / updateRating

Function updateRating

app/scripts/rank-base-models.ts:87–103  ·  view source on GitHub ↗
(model1: string, model2: string, score: number)

Source from the content-addressed store, hash-verified

85 const getRating = (model: string) => ratingsCache[model] ?? { mu: 24, sigma: 1, matches: 0 };
86
87 const updateRating = (model1: string, model2: string, score: number) => {
88 const rating1 = getRating(model1);
89 const rating2 = getRating(model2);
90
91 const [team1, team2] = rate([[rating1], [rating2]], {
92 score: [score, 1 - score],
93 model: bradleyTerryFull,
94 });
95
96 const newRating1 = team1?.[0];
97 const newRating2 = team2?.[0];
98
99 if (!newRating1 || !newRating2) throw new Error("Expected new rating");
100
101 ratingsCache[model1] = { ...newRating1, matches: rating1.matches + 1 };
102 ratingsCache[model2] = { ...newRating2, matches: rating2.matches + 1 };
103 };
104
105 for (let i = 0; i < epochs; i++) {
106 for (const match of shuffle(matchesSlice)) {

Callers 1

runOneTournamentFunction · 0.85

Calls 1

getRatingFunction · 0.85

Tested by

no test coverage detected