winning

A generalization of factor multinomial probit models that scales to millions of variables

This package provides a novel fast algorithm for computing probabilities of contests where performances are correlated and margins (performance distributions) take almost any form. Moreover the inverse operation of calibrating location parameters is also handled, not to mention other computations useful for econometrics at scale (probit with millions of variables), rating systems, portfolio allocation and so forth.

The model, live

Six runners moved by two common luck factors; whichever draws the smallest performance wins. Drag each runner's ability and its two factor loadings, pick the noise distribution (and its skew), and the win probabilities update live. They are computed in your browser by the factor lattice algorithm this package ships, at verified parity with the Python. Runners loading the same factor with the same sign are teammates, opposite signs rivals; zero loadings recover the independent race, where Gumbel noise reproduces softmax exactly.

noise:

Forward pricing to ten million, inversion to one million. All shares of a correlated race in one O(QNL) pass, with graph-Laplacian derivatives that are matrix-free for the factor grammar, and inversion of observed shares back to utilities. A million alternatives price in 29 seconds under a rank-one factor; inversion at a million takes 80 seconds independent and about twenty minutes rank-one. Every number comes from a committed, seeded script. The paper (PDF, tag paper-r11) →
Rating systems live on this engine. Whole-density beliefs, exact full-finish-order updates, benchmarked prequentially on twelve datasets against TrueSkill, OpenSkill, Glicko-2 and Elo. The ratings page →

Quick start

from winning import race_probabilities, calibrate_abilities, removal_shares

p = race_probabilities(mu, V=V, D=D)     # all N shares, one field pass
mu_hat = calibrate_abilities(p, V=V, D=D)  # abilities back from shares
q = removal_shares(mu, V=V, D=D)         # P(j wins | i removed), all pairs

Max-wins semantics for the probit literature live in winning.probit (shares, calibrate_utilities, supplied-covariance fitting); the density-agnostic research engine in winning.research; the paper-faithful kernels in winning.factor.

Covariance grammars

Every grammar describes the same min-race $Y = \mu + \text{noise}$; the grammars are declarative descriptions of the noise covariance that admit $O(N)$-per-lattice-point evaluation. With the normal base they are Gaussian covariance grammars; Independent and Factor also accept any supported smooth base, while Blocks, Nested and Tree are Gaussian only. Pass any of them as structure= to the front-door verbs.

from winning import (Independent, Factor, Blocks, Nested, Tree,
                     race_probabilities, polish_race)

tree = Tree.from_linkage(Z)                    # floored cophenetic correlation
race_probabilities(mu, structure=Factor(V, D))        # Σ = VV' + diag(D)
race_probabilities(mu, structure=Blocks(cluster, loading, D))
race_probabilities(mu, structure=Nested(cluster, loading, D, coupling, gamma))
race_probabilities(mu, structure=tree)
polish_race(p0=w, structure=tree, name_caps=0.05)     # nearest race under caps

Tree.from_linkage builds the race whose implied correlation is the floored cophenetic correlation of a hierarchical clustering (merge height maps through $\rho=\max(1-2h^2,0)$; negative cophenetic correlation has no tree representation). A portfolio's HRP weights can therefore be inverted, re-priced and polished along the dendrogram they came from.

Analytic fixed-grid Jacobians (rows sum to zero; off-diagonals are photo-finish tie densities) ship for the factor, block and nested grammars, with preconditioned Newton inversion throughout. An arbitrary dense $\Sigma$ is priced by fitting the grammar family (seriated blocks under global factors) and promoting the residual to extra factor dimensions. That is one seeded, reproducible call; it beats million-draw Monte Carlo on wall clock at $n = 2000$ and prices tail probabilities Monte Carlo cannot see.

Languages

The numpy implementation is the spec. The compiled kernels (fastrace, thin pyo3 bindings over the pure-rust winning crate) accelerate every path: 232× on the classic calibration, and input-bound to ten million runners on the block field. The base-R package mirrors the complete API with no compiled dependency.

All ports are parity-locked: parity/vectors.json embeds inputs and outputs from the reference, and every language replays the same twenty-two scenarios. Nineteen agree to within 1e-7 (most to 1e-10), and the three fit- or optimizer-mediated ones to between 5e-4 and 5e-3.

pip install winning          # pure python (numpy/scipy)
pip install winning[fast]    # + compiled kernels (abi3 wheels)
pip install winning[certified]  # + winning.certified: Arb-ball enclosures (python-flint)
remotes::install_github("microprediction/winning", subdir = "r/winning")

Random test covariances come from randomcov: fifteen named ensembles. A random covariance matrix is defined only once its distribution is specified.

Papers

Older presentations

Demos

Heritage

The fastest time, the best offer and
        the most popular product are the same order statistic: winner of many.
The fastest time, the lowest offer and the most popular choice are the same computation: the distribution of the winner of many.

winning began as the reference implementation of the SIAM paper above. By Peter Cotton, with sibling packages at microprediction. The same computation, inferring latent ability from who wins, has been rediscovered field by field for a century, from Thurstone's 1927 law of comparative judgment to language-model leaderboards: the heritage, as a timeline →

Notes: disks do not fail independently: a common-cause factor in the public Backblaze data, and what it costs erasure-coding durability.

Get the source

github.com/microprediction/winning · pip install winning · Research scripts