openskill.js
A JavaScript / TypeScript implementation of the Weng-Lin Bayesian online skill-ranking method, described in A Bayesian Approximation Method for Online Ranking.
openskill is a faster, simpler, and patent-free alternative to TrueSkill that
supports asymmetric teams, free-for-all matches, partial rankings, ties,
partial play, and victory margins.
Why openskill?
- Fast — up to 20× faster than TrueSkill (see the benchmarks).
- Flexible — Bradley-Terry, Thurstone-Mosteller, and Plackett-Luce models, plus per-player partial-play weights and score-based victory margins.
- Portable — bit-for-bit compatible with the reference Python implementation, so you can train in one runtime and serve in another.
- Tiny API —
rating,rate,ordinal,predictWin,predictDraw,predictRank. That's it.
Speed
| Model | Speed (higher is better) | Variance | Samples |
|---|---|---|---|
| Openskill/bradleyTerryFull | 62,643 ops/sec | ±1.09% | 91 runs sampled |
| Openskill/bradleyTerryPart | 40,152 ops/sec | ±0.73% | 91 runs sampled |
| Openskill/thurstoneMostellerFull | 59,336 ops/sec | ±0.74% | 93 runs sampled |
| Openskill/thurstoneMostellerPart | 38,666 ops/sec | ±1.21% | 92 runs sampled |
| Openskill/plackettLuce | 23,492 ops/sec | ±0.26% | 91 runs sampled |
| TrueSkill | 2,962 ops/sec | ±3.23% | 82 runs sampled |
See this post for more.
Implementations in other languages
The same algorithm has been ported to several other ecosystems. The Examples by Language section of this site shows idiomatic usage for each port.
| Language | Repository |
|---|---|
| JavaScript | philihp/openskill.js |
| Python | vivekjoshy/openskill.py |
| Java | pocketcombats/openskill-java |
| Kotlin | brezinajn/openskill.kt |
| Elixir | philihp/openskill.ex |
| Lua | bstummer/openskill.lua |
| Google Apps Script | haya14busa/gas-openskill |
| Google Sheets | Spreadsheet template |