It is currently Tue May 06, 2025 1:19 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
Offline
 Post subject: An implementation of Whole History Rating (WHR)
Post #1 Posted: Sat Aug 27, 2011 7:11 pm 
Lives in gote

Posts: 653
Location: Austin, Texas, USA
Liked others: 54
Was liked: 216
Fellow ratings math nerds! I made an implementation of Whole History Rating (WHR) in python, you can find it here: https://bitbucket.org/KillerDucky/misc (see the whr directory).

I also updated the senseis page with a few examples of how it acts in certain cases:
http://senseis.xmp.net/?WholeHistoryRating In particular it is much less prone to having your rating get stuck from having many games in your past history.

I couldn't get Newton's method as described in Remi's paper to work, so I had to use a much slower bisection method instead.


This post by yoyoma was liked by 6 people: daniel_the_smith, dfan, emeraldemon, Harleqin, HermanHiddema, shapenaji
Top
 Profile  
 
Offline
 Post subject: Re: An implementation of Whole History Rating (WHR)
Post #2 Posted: Sun Aug 28, 2011 2:36 am 
Gosei
User avatar

Posts: 2011
Location: Groningen, NL
Liked others: 202
Was liked: 1087
Rank: Dutch 4D
GD Posts: 645
Universal go server handle: herminator
:clap:

Top
 Profile  
 
Offline
 Post subject: Re: An implementation of Whole History Rating (WHR)
Post #3 Posted: Sun Aug 28, 2011 6:49 am 
Gosei
User avatar

Posts: 2116
Location: Silicon Valley
Liked others: 152
Was liked: 330
Rank: 2d AGA
GD Posts: 1193
KGS: lavalamp
Tygem: imapenguin
IGS: lavalamp
OGS: daniel_the_smith
Nice!

And you get extra points for using hg/bitbucket ;-)

Edit: Ok, I was going to take a stab at getting Newton to work, but I'm a little confused-- I don't see it computing terms of the Weiner prior or the Hessian matrix. :scratch:

Edit 2: Optimization wise, you binary search the entire rating space for every player every main loop-- it seems like you could decrease the space you binary search with each loop. For example, take the maximum change from the last loop, and search a space twice that big instead of going from MAX_RATING all the way to MIN_RATING. This ought to speed up later iterations a fair amount without changing the result. I bet you could also vary CLOSE_ENOUGH, start at (say) 5 or 10 on the first iteration and decrease it logarithmically every iteration until it gets down to .1-- that ought to decrease time spent in the inner loop in early iterations.

_________________
That which can be destroyed by the truth should be.
--
My (sadly neglected, but not forgotten) project: http://dailyjoseki.com

Top
 Profile  
 
Offline
 Post subject: Re: An implementation of Whole History Rating (WHR)
Post #4 Posted: Sun Aug 28, 2011 8:35 am 
Lives in gote

Posts: 653
Location: Austin, Texas, USA
Liked others: 54
Was liked: 216
daniel_the_smith wrote:
Edit: Ok, I was going to take a stab at getting Newton to work, but I'm a little confused-- I don't see it computing terms of the Weiner prior or the Hessian matrix. :scratch:

Ok I added newtons_whr.py. Remove the exception at the top of the file and run it. The example shows a player named yoyoma :cool: going on a winning streak. By the time you reach 'day=100 wins=13' you can see Newton's method starts to oscillate. By 'day=100 wins=24' it starts to get really out of hand.

I'm not really much of a mathematician, so I was blindly following Remi's example. But from my limited understanding, the Hessian matrix is just used to execute Newton's method, so when I switched to bisection I ditched it. Similarly the Weiner prior is implemented by making virtual draws between a players previous/next vpds.

daniel_the_smith wrote:
Edit 2: Optimization wise, you binary search the entire rating space for every player every main loop-- it seems like you could decrease the space you binary search with each loop. For example, take the maximum change from the last loop, and search a space twice that big instead of going from MAX_RATING all the way to MIN_RATING. This ought to speed up later iterations a fair amount without changing the result. I bet you could also vary CLOSE_ENOUGH, start at (say) 5 or 10 on the first iteration and decrease it logarithmically every iteration until it gets down to .1-- that ought to decrease time spent in the inner loop in early iterations.


Yes I didn't do much to try to optimize it. For now it runs fast enough for my experiments.

Top
 Profile  
 
Offline
 Post subject: Re: An implementation of Whole History Rating (WHR)
Post #5 Posted: Sun Aug 28, 2011 12:35 pm 
Lives in gote

Posts: 409
Liked others: 29
Was liked: 182
GD Posts: 1072
yoyoma wrote:
I'm not really much of a mathematician, so I was blindly following Remi's example. But from my limited understanding, the Hessian matrix is just used to execute Newton's method, so when I switched to bisection I ditched it. Similarly the Weiner prior is implemented by making virtual draws between a players previous/next vpds.


Where is the sigma parameter buried in the program? I don't see it, and you need a value even if you're only doing a bisection method.

I got as far as implementing a test version in C++ some time ago. If you want to cross-check test data, feel free to drop me a line.

Top
 Profile  
 
Offline
 Post subject: Re: An implementation of Whole History Rating (WHR)
Post #6 Posted: Sun Aug 28, 2011 12:54 pm 
Gosei
User avatar

Posts: 2116
Location: Silicon Valley
Liked others: 152
Was liked: 330
Rank: 2d AGA
GD Posts: 1193
KGS: lavalamp
Tygem: imapenguin
IGS: lavalamp
OGS: daniel_the_smith
This is fascinating to me, I wish I didn't have bugs of my own to fix so I could play with it more... :sad:

_________________
That which can be destroyed by the truth should be.
--
My (sadly neglected, but not forgotten) project: http://dailyjoseki.com

Top
 Profile  
 
Offline
 Post subject: Re: An implementation of Whole History Rating (WHR)
Post #7 Posted: Sun Aug 28, 2011 1:09 pm 
Lives in gote

Posts: 653
Location: Austin, Texas, USA
Liked others: 54
Was liked: 216
pwaldron wrote:
yoyoma wrote:
I'm not really much of a mathematician, so I was blindly following Remi's example. But from my limited understanding, the Hessian matrix is just used to execute Newton's method, so when I switched to bisection I ditched it. Similarly the Weiner prior is implemented by making virtual draws between a players previous/next vpds.


Where is the sigma parameter buried in the program? I don't see it, and you need a value even if you're only doing a bisection method.

I got as far as implementing a test version in C++ some time ago. If you want to cross-check test data, feel free to drop me a line.


sigma? To me that implies an algorithm that takes a player's previous rating, has an uncertainty value (this is sigma), and then adds in new game results. This algorithm recalculates using all results so you don't really have the concept of the old rating.

There is something close to that though in the PRIOR_WEIGHT and PRIOR_ANCHOR stuff, where all players have two fake games, a win and a loss, against the PRIOR_ANCHOR. The rating of the PRIOR_ANCHOR is hidden in the whr_test.py file, I should refactor that into the main whr.py file. Also for the tests I was doing in whr_test.py, all games are played by a test player against anchors who have their rating fixed, just to make simple idealist test scenarios.

On the subject of key constants, the other important one is LINK_STRENGTH, which controls the strength of the connection between player days. Or in other words how fast player's ratings can change over time.

Top
 Profile  
 
Offline
 Post subject: Re: An implementation of Whole History Rating (WHR)
Post #8 Posted: Mon Aug 29, 2011 6:04 am 
Lives in gote

Posts: 409
Liked others: 29
Was liked: 182
GD Posts: 1072
yoyoma wrote:
sigma? To me that implies an algorithm that takes a player's previous rating, has an uncertainty value (this is sigma), and then adds in new game results. This algorithm recalculates using all results so you don't really have the concept of the old rating.


My bad. What I was looking for was the value of the w parameter, which determines how much ratings are allowed to drift over time. I was thinking it was originally labelled sigma, but it wasn't.

Top
 Profile  
 
Offline
 Post subject: Re: An implementation of Whole History Rating (WHR)
Post #9 Posted: Wed Aug 31, 2011 12:13 am 
Lives in gote

Posts: 653
Location: Austin, Texas, USA
Liked others: 54
Was liked: 216
I got some data for Starcraft2 and ran WHR on it. See results here:

http://www.teamliquid.net/forum/viewmes ... _id=261080

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group