Extended Elo rating system implementation exploiting the equivalence with logistic regression.
Project description
:chess_pawn: EloGrad
Extended Elo rating system implementation exploiting the equivalence with logistic regression.
EloGrad (Elo as Gradient descent) leverages the framing of the
Elo rating system
as logistic regression with stochastic gradient descent
(see this blog for a nice walkthrough)
to offer a collection of extensions to the rating system.
All models are scikit-learn
compatible.
:book: Installation
You can install elo-grad
with:
pip install elo-grad
:zap: Quick Start
Detailed example notebooks are provided in the examples/
directory.
To install any extra dependencies required to run the notebooks install with:
pip install elo-grad[examples]
:clipboard: Minimal Example
from elo_grad import EloEstimator
# Input DataFrame with sorted index of Unix timestamps
# and columns entity_1 | entity_2 | score
# where score = 1 if player_1 won and score = 0 if
# player_2 won.
df = ...
estimator = EloEstimator(
k_factor=20,
default_init_rating=1200,
entity_cols=("player_1", "player_2"),
score_col="result",
)
# Get expected scores
expected_scores = estimator.predict_proba(df)
# Get final ratings (of form (Unix timestamp, rating))
ratings = estimator.model.ratings
:compass: Roadmap
In rough order, things we want to add are:
- Poisson model support
- Regularization (L1 & L2)
- Support for Polars
- Head-to-head ratings
- Interaction terms
- Other optimizers, e.g. momentum
- Support for draws
- Extend plotting support, e.g. plotly
:blue_book: References
- Elo rating system: https://en.wikipedia.org/wiki/Elo_rating_system
- Elo rating system as logistic regression with stochastic gradient descent: https://stmorse.github.io/journal/Elo.html
- Elo rating system for NFL predictions: https://fivethirtyeight.com/methodology/how-our-nfl-predictions-work/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file elo_grad-0.3.0.tar.gz
.
File metadata
- Download URL: elo_grad-0.3.0.tar.gz
- Upload date:
- Size: 248.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.4.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7b7820e59d989ea186bd50a98097f7d5445912f2d61d9ab4c14855998d42701 |
|
MD5 | 0da57a9bb066b11c527a2d466b7d47c0 |
|
BLAKE2b-256 | e35301d7280dc07f6e0e68e735ee008dc069f5a7955f0d4a8a1fd02011208e67 |
File details
Details for the file elo_grad-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: elo_grad-0.3.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.4.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1daa485b8b11cc586bd4d743734772df8e6f38ac144e4cbf93866846cdce2c1d |
|
MD5 | 23b63f36fcee4fcd5c629bdbc3627293 |
|
BLAKE2b-256 | 746a983d50af0712ef9c6d5efff02aecd408a83df81bcb2b83fcb25169390de9 |