pfmonville / whole_history_rating Goto Github PK
View Code? Open in Web Editor NEWa python convertion from the ruby implementation of Rémi Coulom's Whole-History Rating (WHR) algorithm.
License: MIT License
a python convertion from the ruby implementation of Rémi Coulom's Whole-History Rating (WHR) algorithm.
License: MIT License
On this line:
The uncertainty attribute (which is the variance if I understood correctly the code) is multiplied by 100 for some unknown reason. The documentation of this function says it returns the uncertainty, so why does it multiply it by 100?
Thank you for sharing such a helpful resource. I have a question regarding the usage of the day number in the create_game() function.
If a tournament has 5 rounds in one day, with each round containing 7 games, how should the day number be input into the create_game() function?
Should all games on the same day have the same day number (and should the day number be input as a date in the format YYYYMMDD, like 20240804, or simply increment from 1 for each new day in different tournaments)?
Alternatively, should I increment the day number for each game within the same day? Or should the 7 games in each round share the same day number, but different from other rounds?
I am seeking clarification on the precise usage of the day number in this context.
Thank you for your assistance.
Best regards,
Hello,
Is there any way to set initial ratng on WHR?
When I inserted first game results, initial highest ratings were 400~500. and after inserting several year results, peak rating was not over 1500 either.
Also there were many - rating players and there was almost -1,000 rating player.
I would like to make overall ratings more higher, so is there any to set initial rating?
I used w2 parameter as 300.
Double checked the games are in the right format and when I try and load them in I get this error.
whr.load_games(whr_hist, separator=",")
KeyError Traceback (most recent call last)
Input In [325], in <cell line: 1>()
----> 1 whr.load_games(whr_hist, separator=",")
File ~\anaconda3\lib\site-packages\whr\whole_history_rating.py:309, in Base.load_games(self, games, separator)
307 black = black.lower()
308 white = white.lower()
--> 309 self.create_game(black, white, winner, time_step, handicap, extras=extras)
File ~\anaconda3\lib\site-packages\whr\whole_history_rating.py:145, in Base.create_game(self, black, white, winner, time_step, handicap, extras)
143 black = black.lower()
144 white = white.lower()
--> 145 game = self._setup_game(black, white, winner, time_step, handicap, extras)
146 return self._add_game(game)
File ~\anaconda3\lib\site-packages\whr\whole_history_rating.py:121, in Base._setup_game(self, black, white, winner, time_step, handicap, extras)
119 if black == white:
120 raise AttributeError("Invalid game (black player == white player)")
--> 121 white_player = self.player_by_name(white)
122 black_player = self.player_by_name(black)
123 game = Game(black_player, white_player, winner, time_step, handicap, extras)
File ~\anaconda3\lib\site-packages\whr\whole_history_rating.py:93, in Base.player_by_name(self, name)
91 name = name.lower()
92 if self.players.get(name, None) is None:
---> 93 self.players[name] = Player(name, self.config)
94 return self.players[name]
File ~\anaconda3\lib\site-packages\whr\player.py:13, in Player.init(self, name, config)
10 self.debug = config.get('debug', False)
11 self.w2 = (math.sqrt(config['w2']) * math.log(10.) /
12 400.)**2. # Convert from elo^2 to r^2
---> 13 self.virtual_games = config['virtual_games']
14 self.days = []
KeyError: 'virtual_games'
import pandas as pd
whr = whole_history_rating.Base()
df = pd.read_csv('MDB.csv', sep=',')
whr.load_games([df.home_team, df.away_team, "W", 0], separator=",")
whr.auto_iterate(time_limit = 10, precision = 10E-3)
File "C:\intelo\whrwhr.py", line 8, in <module>
whr.load_games([df.home_team, df.away_team, "W", 0], separator=",")
File "C:\Users\under\AppData\Local\Programs\Python\Python310\lib\site-packages\whr\whole_history_rating.py", line 266, in load_games
arguments = [x.strip() for x in line.split(separator)]
File "C:\Users\under\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\generic.py", line 5902, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'split'. Did you mean: 'plot'?
I'm running your library on a few years worth of data (starting in 2014 - now) in a relatively volatile sport. There are approximately 60,000 matches. I'm receiving the exception "unstable r on player".
Does this mean that there's a bug in my code somewhere? Or perhaps the algorithm doesn't work as well on this particular sport?
iterates iteratively ten by ten
is confusing languagetime_limit (int, optional): the maximal time after
should mention that the time limit is measured in secondsI'm not sure the best way to improve these
In the PlayerDay class, there are functions called won_game_terms and lost_game_terms.
Say in the won_game_terms function, for each game a player has won, we append this:
[1.0,0.0,1.0,other_gamma]
And similarly to the lost games terms, we append this:
[0.0,other_gamma,1.0,other_gamma]
Clearly I know what the gamma is as that is defined but what do the other positions/numbers in these lists represent?
The data exceeds 3200 games, and during iteration, a 'bad adjusted gamma' error occurs.
After the error appears, the results show that a specific player has an abnormally high rating.
{
"499": 15820.314153319185,
"300": 624.9808229062172,
"299": 591.5682009170249,
"36": 578.8136388010431,
"655": 577.0898912577412,
"347": 541.4121475900309,
The error occurs regardless of whether the iteration is done automatically, manually, or manually with 10 iterations.
There are no issues during the game input process, but the error occurs during the iteration.
Here is the data insert code and the game result files. The data insert is designed to load and process data by folders, and it works well for 1991 and 1992. However, in 1993, a 'bad adjusted gamma' error occurs. The error has been identified to occur in the '19931105_WOC_1993.ELO' file, but running this file individually or processing only the 1993 data works fine, making it difficult to pinpoint the exact cause.
Inputting the 1991 folder => Successfully completed
Inputting the 1992 folder (loading 1991.whr) => Successfully completed
Inputting the 1993 folder (loading 1992.whr) => 'bad adjusted gamma' error occurs
Inputting the 1993 folder without loading an existing whr => Successfully completed
hello,
congrats for your work, I was wondering if there is a way to get the win probabilities for all the history. Maybe use the history ratings to derive it?
It would be useful to get a more precise estimate of the accuracy/mse than a train/test split
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.