Skip to main content

vectorized implementations of online rating systems

Project description

Open source implementations of online rating systems focusing on efficiency for offline experimentation

When to use riix

This package is designed to accelerate experiments studying and comparing rating systems. In the scenario where you have paired comparison datasets with a known number of competitors and time range, riix exploits that information to achieve fast runtimes. It's not useful in the streaming case where new data with new competitors are coming in. It also only currently supports 1v1 competitions but future support for two team competitions is planned. (more than 2 teams is not)

I have a large dataset of player matches for a game and want to determine which rating system out of Elo, Glicko, TrueSkill etc. gives the best predictive accuracy.

Use riix! 👍

I want to incorporate skill based matchmaking into the game I am creating and want a package to compute ratings for players on the fly.

There are lots of other great python packages for that too! (just not riix)

Example

from riix.models.elo import Elo
from riix.utils import MatchupDataset, split_matchup_dataset, generate_matchup_data
from riix.metrics import binary_metrics_suite

df = generate_matchup_data() # replace with your **polars** dataframe
dataset = MatchupDataset(
    df,
    competitor_cols=['competitor_1', 'competitor_2'],
    outcome_col='outcome',
    datetime_col='date',
    rating_period='1D',
)
train_dataset, test_dataset = split_matchup_dataset(dataset, test_fraction=0.2)
print(f'{len(train_dataset)=}, {len(test_dataset)=}')

>>> loaded dataset with:
>>> 10000 matchups
>>> 100 unique competitors
>>> 10 rating periods of length 1D
>>> len(train_dataset)=8000, len(test_dataset)=2000

model = Elo(competitors=dataset.competitors)
model.fit_dataset(train_dataset)
test_probs = model.fit_dataset(test_dataset, return_pre_match_probs=True)
test_metrics = binary_metrics_suite(probs=test_probs, outcomes=test_dataset.outcomes)
print(test_metrics)

>>> {'accuracy': 0.72975, 'log_loss': 0.5359083106524117, 'brier_score': 0.1793377446861956}

model.print_leaderboard(num_places=5)

>>> competitor   	rating
>>> competitor_69	1874.170019
>>> competitor_75	1827.933570
>>> competitor_12	1826.119826
>>> competitor_81	1825.071605
>>> competitor_30	1802.338983

License

This package is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. I've chosen a non-commercial license as overbroad protection to prevent the use of this package in the gambling and odds setting industries. If you would like to use riix for your business in any other area please do not hesitate to reach out and I'll happily grant you an eternal lifetime license. :)

About the name

The name riix represents an attempt to cleverly represent the idea of "R8" (pronounced "rate") alphabetically using the Roman numeral IIX in place of 8. By the time I realized the correct numeral would have been VIII I was already attatched to the name riix so I stuck with it. However on further research it turns out the Romans themselves occasionally used this form as well! Why Romans Sometimes Wrote 8 as VIII, And Sometimes as IIX: A Possible Explanation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

riix-0.0.6.tar.gz (46.1 kB view details)

Uploaded Source

Built Distribution

riix-0.0.6-py3-none-any.whl (63.4 kB view details)

Uploaded Python 3

File details

Details for the file riix-0.0.6.tar.gz.

File metadata

  • Download URL: riix-0.0.6.tar.gz
  • Upload date:
  • Size: 46.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for riix-0.0.6.tar.gz
Algorithm Hash digest
SHA256 1b1e31973daff18c88e0e6b6cc02f15d292fab766a7fdc4f82e49d42ba6a9c35
MD5 3ece60c5c5d426bd32d4e6602e0a9a8d
BLAKE2b-256 ae896943a0388710bcc673e18f0c5f50d981cec71b8b0a93f16545cebf65bb0c

See more details on using hashes here.

File details

Details for the file riix-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: riix-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 63.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for riix-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 23be114e699c64f004bca1571b8f3cbc00a81000711dec7aa06772d291434dda
MD5 7159b13771e74dc360bd166176186181
BLAKE2b-256 2ce96ec8ba4eabb4df5a8568e8b51201f44935cb84dc07d626ad0942234e0432

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page