views:

304

answers:

5

In our office, we regularly enjoy some rounds of foosball / table football after work. I have put together a small java program that generates random 2vs2 lineups from the available players and stores the match results in a database afterwards.

The current prediction of the outcome uses a simple average of all previous match results from the 4 involved players. This gives a very rough estimation, but I'd like to replace it with something more sophisticated, taking into account things like:

  • players may be good playing as attacker but bad as defender (or vice versa)
  • players do well against a specific opponent / bad against others
  • some teams work well together, others don't
  • skills change over time

What would be the best algorithm to predict the game outcome as accurately as possible?

Someone suggested using a neural network for this, which sounds quite interesting... but I do not have enough knowledge on the topic to say if that could work, and I also suspect it might take too many games to be reasonably trained.

EDIT:
Had to take a longer break from this due to some project deadlines. To make the question more specific:

Given the following mysql table containing all matches played so far:

table match_result

match_id      int pk
match_start   datetime
duration      int (match length in seconds)
blue_defense  int fk to table player
blue_attack   int fk to table player
red_defense   int fk to table player
red_attack    int fk to table player
score_blue    int
score_red     int

How would you write a function predictResult(blueDef, blueAtk, redDef, redAtk) {...}
to estimate the outcome as closely as possible, executing any sql, doing calculations or using external libraries?

+2  A: 

Why use a neuralnet? Use statistics, probably the correlation between each player would be good measure.

leppie
Exactly. Some people suggest a Neural Net for *everything*; see The Daily WTF: http://thedailywtf.com/Articles/No,_We_Need_a_Neural_Network.aspx :-)
ShreevatsaR
+1  A: 

Just to start let's gather some information: For a given player we need:

  1. the position they played
  2. the final score

A good attacker will rack up points. A good defender will prevents points from being scored.

The real info will be from a good attacker playing against a good defender.

Robert
A: 

Try applying Naive Bayes classifier.

Bayesian learning is a probabilistic approach which is based on an assumption that the quantities of interest are governed by probability distributions and that optimal decisions can be made by reasoning about these probabilities together with observed data. [Mitchell, T. (1997), Machine Learning]

The same exact distribution of the players may result in different match results. If your data has a pattern in it, a pattern based on your variables, Naive Bayes classifier may produce good results.

The algorithm is not very complex. I think, one with some knowledge in probability, can understand & apply it.

In intrusion detection systems, it is being used for determining network anomalies, by looking at various network parameters. Bayesian approach may be very successful in particular types of data and produce high TP & low FP rates. But it may also result in high FP rates, depending on your data. Your data will determine the best approach.

You can use Weka (http://www.cs.waikato.ac.nz/~ml/weka/), a data mining software library, and try different algorithms. It contains the Naive Bayes classifier. Just try and see.

Eren Aygunes
A: 

One option would be to try and guess the point spread as some sort of linear model. If you have more games than players you, can do a least squares fit of points per player by building a games matrix (+1 for player on one team, -1 for the other, 0 for spectator) for all the games and a result vector for the spreads.

BCS
+1  A: 

Use the TrueSkill algorithm, it is very good at this. I've implemented it for foosball and chess and it works very well. Coworkers have told me that it's almost too good at this.

For complete details on how it works as well as a link to my implementation, see my "Computing Your Skill" blog post.

Jeff Moser