Saturday, February 19, 2011

Modeling Chess with Probabilistic Matrix Factorization

Posted by Danny Tarlow
Dirk writes...
Thanks for posting your code and ideas on your blog. I was playing around with your PMF code applying it to chess games, where users are white and items are black. Because players can play more than once against each other, would you remove the duplicate pairs?
Cool. It sounds like an interesting application.

I don't see any reason to remove duplicate pairs. If different games have different outcomes, you definitely want to keep both to prevent biasing the model. If there are duplicate games with the same outcome, we should be more confident that the outcome wasn't a fluke, so it roughly makes sense that we'd want to weight it a bit more (which is the effect of having duplicate entries in the data set).

It's a bit strange to apply the vanilla model chess, though. There is no relationship in the model between player X as white and player X as black--they might as well be two separate people. It may be interesting to look at extensions where the latent vectors for player X as white are constrained to be similar as the latent vectors for player X as black.

Do any readers disagree?

(The relevant code is here.)

2 comments:

DN said...

Thanks for the answer. I am not sure I understand your last paragraph.

There is definitely a bias in chess, in that white wins more than black. However if you neglect that, you could train each game twice so that you swap white and black. Bascially you get a square matrix.

Since the outcome of a game is 0, 0.5 or 1, I have played around with the logistic function but the convergence is very slow.

Danny Tarlow said...

I see. Then at test time when A plays B, you take something like the average of predictions for A_white vs B_black and A_black vs B_white?

I suppose that's reasonable, but in this case, there is no distinction between white and black. I was thinking of a half-way solution, where the latent vectors A_white and A_black are encouraged to be similar, but not exactly the same. But I think your solution is a good first pass.