sublee / trueskill

An implementation of the TrueSkill rating system for Python
https://trueskill.org/
Other
742 stars 112 forks source link

Workable sample code #16

Closed moiseyo closed 6 years ago

moiseyo commented 6 years ago

I'm new with that package, and I'd like to use a small sample code I could run in Python 3.6

Thank you

sublee commented 6 years ago

Is the documentation not enough?

moiseyo commented 6 years ago

Thank you, I found very helpful

The view only changes for the lead dog.

On Tue, Oct 3, 2017 at 10:47 AM, Heungsub Lee notifications@github.com wrote:

Is the documentation http://trueskill.org/#head-to-head-1-vs-1-match-rule not enough?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sublee/trueskill/issues/16#issuecomment-333865792, or mute the thread https://github.com/notifications/unsubscribe-auth/AFEYqmUWyF_vA8ZqKmWNoCRNBFDUe5s2ks5sokj-gaJpZM4PpNWF .

bernd-wechner commented 6 years ago

For what it's worth I have a property called "TrueSkill Code" attached to every session record which I have used in past to debug and is useful for debugging. The site it runs on is not up reliably all the time and in an alpha state at present, but you can see data there and a sample looks like this:


#!/usr/bin/python3
import trueskill
mu0 = 25.0
sigma0 = 8.333333333333334
beta = 4.166666666666667
delta = 0.0001
tau = 0.0833333333333333
p = 0.1
TS = trueskill.TrueSkill(mu=mu0, sigma=sigma0, beta=beta, tau=tau, draw_probability=p)
oldRGs = [{46: trueskill.Rating(mu=19.960, sigma=2.352)}, {13: trueskill.Rating(mu=24.736, sigma=1.343)}, {21: trueskill.Rating(mu=27.773, sigma=1.592)}, {12: trueskill.Rating(mu=22.221, sigma=1.541)}, {1: trueskill.Rating(mu=26.780, sigma=1.054)}, {20: trueskill.Rating(mu=26.672, sigma=1.403)}]
Weights = {(0, 46): 1.0, (1, 13): 1.0, (2, 21): 1.0, (3, 12): 1.0, (4, 1): 1.0, (5, 20): 1.0}
Ranking = [1, 2, 3, 4, 5, 6]
newRGs = TS.rate(oldRGs, Ranking, Weights, delta)
print(newRGs)

That's a snippet from a recent session. I shan't link to the site just yet, as I'm not wanting to draw more traffic than needed and any link on a forum like will start to see robots all over it (ha, ha, the fate of all web sites eventually), I have it exposed but for testing in the local games group.

This issue can close resolved BTW.