For a while we've had no good free alternative to trueskill. Anyone that used trueskill was always plagued with doubt about whether there would be any repercussions for using it in commercial projects. Luckily there was already a package for javascript that solved this issue by implementing the Weng-Lin Bayesian ranking system. So I decided to port it to python. Hope this is useful to the general Python community and those creating systems that need ranking.

## Installation

```
pip install openskill
```

## Usage

```
>>> from openskill import Rating, rate
>>> a1 = Rating()
>>> a1
Rating(mu=25, sigma=8.333333333333334)
>>> a2 = Rating(mu=32.444, sigma=5.123)
>>> a2
Rating(mu=32.444, sigma=5.123)
>>> b1 = Rating(43.381, 2.421)
>>> b1
Rating(mu=43.381, sigma=2.421)
>>> b2 = Rating(mu=25.188, sigma=6.211)
>>> b2
Rating(mu=25.188, sigma=6.211)
```

If `a1`

and `a2`

are on a team, and wins against a team of `b1`

and `b2`

, send this into rate:

```
>>> [[x1, x2], [y1, y2]] = rate([[a1, a2], [b1, b2]])
>>> x1, x2, y1, y2
([28.669648436582808, 8.071520788025197], [33.83086971107981, 5.062772998705765], [43.071274808241974, 2.4166900452721256], [23.149503312339064, 6.1378606973362135])
```

You can also create `Rating`

objects by importing `create_rating`

:

```
>>> from openskill import create_rating
>>> x1 = create_rating(x1)
>>> x1
Rating(mu=28.669648436582808, sigma=8.071520788025197)
```

## Ranks

When displaying a rating, or sorting a list of ratings, you can use `ordinal`

:

```
>>> from openskill import ordinal
>>> ordinal(mu=43.07, sigma=2.42)
35.81
```

## Discussion (0)