Weng-Lin Bayesian approximation method for online skill-ranking.
npm install musrank
bash
npm install --save musrank
`
Quick start
`js
import { rating, rate } from 'musrank'
const a1 = rating()
const a2 = rating()
const b1 = rating()
const b2 = rating()
const [[a1p, a2p], [b1p, b2p]] = rate([a1, a2], [b1, b2], {
rank: [1, 2],
})
`
2v2 parameter exploration
Run a local sweep (2v2 only, no draws) and print a table with the result, parameter config, and Elo-style mu change:
`bash
npm run build
node exploration/matches-sim.mjs
`
The script runs two scenarios (A wins, B wins) for several parameter sets and prints a console table with:
- result: scenario (A wins / B wins)
- params: named parameter preset (tau values or beta scaling)
- config: JSON of the preset options
- eloChangeA / eloChangeB: average mu change per team
The model: two layers of uncertainty
$3
Each hand has:
- card randomness
- bidding variance
We model this base noise as β₀. Larger β₀ means outcomes are blurrier; smaller β₀ means skill dominates.
$3
Mus is played to L juegos (points). More games average out randomness, so the match-level noise shrinks with L.
Conceptually:
`
beta(L) = beta0 / sqrt(L)
`
Or with a reference match length:
`
beta(L) = beta0 * (Lref / L) ^ alpha
`
Where L is the number of juegos. Short matches are noisy; long matches are reliable.
Example (intuition): if beta(10) = 1.0
- L = 2 → beta(2) ≈ 2.24 (chaotic, weak evidence)
- L = 4 → beta(4) ≈ 1.58 (still swingy)
- L = 20 → beta(20) ≈ 0.71 (stable, decisive)
What “more β” vs “less β” means
- More β → more chaos. Upsets are common, a win provides weak evidence.
- Less β → more determinism. Upsets are rare, a win is strong evidence.
In Mus terms: short matches → high β, long matches → low β.
Think of it like this:
- beta(L) defines the noise (how much to trust a win/loss result)
So the same result gives:
- a small update in a short match (high β)
- a large update in a long match (low β)
Defaults you’ll choose later
These are the two core knobs:
1. β₀ — base hand randomness
2. σ₀ — prior uncertainty for new players
Rule of thumb: start with sigma0 ≈ 1–2 × beta(10)` so new players can move meaningfully after a few matches.