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?
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
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?
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
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?
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'
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.