Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: predictDraw should give same result as python #642

Merged
merged 6 commits into from
Jul 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merge mistake
  • Loading branch information
philihp committed Jul 30, 2024

Verified

This commit was signed with the committer’s verified signature.
abernix Jesse Rosenberger
commit 577a1b95f8632257fdba06da94efb2ee33b51d95
29 changes: 0 additions & 29 deletions src/__tests__/predict-draw.test.ts
Original file line number Diff line number Diff line change
@@ -91,33 +91,4 @@ describe('predictDraw', () => {
).toBeCloseTo(0.11489223845523855, 7)
})
})

it('mirrors results from python', () => {
// from https://github.com/philihp/openskill.js/issues/599
const t1 = [rating({ mu: 25, sigma: 1 }), rating({ mu: 25, sigma: 1 })]
const t2 = [rating({ mu: 25, sigma: 1 }), rating({ mu: 25, sigma: 1 })]
expect(predictDraw([t1, t2])).toBeCloseTo(0.6608263448857606)
})

it('gives a low probability in a 5 team match', () => {
// from https://openskill.me/en/stable/manual.html
const p1 = rating({ mu: 35, sigma: 1.0 })
const p2 = rating({ mu: 35, sigma: 1.0 })
const p3 = rating({ mu: 35, sigma: 1.0 })
const p4 = rating({ mu: 35, sigma: 1.0 })
const p5 = rating({ mu: 35, sigma: 1.0 })

const team1 = [p1, p2]
const team2 = [p3, p4, p5]
expect(predictDraw([team1, team2])).toBeCloseTo(0.0002807397636509501, 10)
})

it('gives a higher probability with fewer players', () => {
// from https://openskill.me/en/stable/manual.html
const p1 = rating({ mu: 35, sigma: 1.0 })
const p2 = rating({ mu: 35, sigma: 1.1 })
const team1 = [p1]
const team2 = [p2]
expect(predictDraw([team1, team2])).toBeCloseTo(0.4868868769871696)
})
})
Loading