Add evaluation operations and reporting
This commit is contained in:
1 parent
60f33b8f4b
commit
6f09408423
57 files changed
+7060
-142
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { createEloRating, scoreForVerdict, updateEloPair } from "./elo.js";
|
||||
|
||||
describe("elo", () => {
|
||||
it("updates equal ratings by the standard K=32 margin", () => {
|
||||
const control = createEloRating("control");
|
||||
const variant = createEloRating("variant");
|
||||
|
||||
const updated = updateEloPair(control, variant, 1);
|
||||
|
||||
expect(updated.ratingA.elo).toBe(1516);
|
||||
expect(updated.ratingB.elo).toBe(1484);
|
||||
expect(updated.ratingA.matches).toBe(1);
|
||||
expect(updated.ratingA.wins).toBe(1);
|
||||
});
|
||||
|
||||
it("maps side-by-side verdicts to scores", () => {
|
||||
expect(scoreForVerdict("A")).toBe(1);
|
||||
expect(scoreForVerdict("B")).toBe(0);
|
||||
expect(scoreForVerdict("tie")).toBe(0.5);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user