# machine learning on athlete performances to predict the time in a future race

Example Data

I have a dataset (in R as a data frame) of race results for athletes.

athlete racedistance time    location tracktype       date    coach
A          100       10.0       UK     typeA       2014-01-01  carlos
A          200       20.0       US     typeB       2014-02-01  carla
A          100        9.5      AUS     typeC       2014-03-01  chris
B          100       11.0       UK     typeA       2014-01-01  carla
B          200       21.0       US     typeB       2014-02-01  carlos
B          400       61.0      AUS     typeC       2014-03-01  carla
B          100       10.5      GER     typeA       2014-04-01  clive
C          100        9.5       UK     typeA       2014-01-01  clive
C          200       21.5       US     typeB       2014-02-01  chris


Question

Is there an appropriate machine learning algorithm or method that can use the previous results of each athlete as a feature, when trying to predict the time for an athlete in a future race?

For example, athlete A has three races, with one month rest between them. In the third race he performs slightly better than the first race over the same distance.

Can an algorithm learn that the second race had an effect on the athlete, which meant he performed better in the third race?

From what I've read on the subject and the training examples I've completed it would appear that each 'row' of data should be independent, is this the case for all ML algorithms? Is there another prediction technique I should be considering to solve this type of problem?

I think the key here is what you believe to be dependent variables. You mentioned, for instance, a three month rest. Encoding the rest between races is likely to be a better idea than simply encoding the date of the rest as a lot of the date is redundant to what is actually being said. As with any machine learning algorithm, representation of the data is key and in many ways, the actual algorithm applied is less important.

• That's along the lines my train of thought is going, thanks. Commented Feb 12, 2015 at 2:02

By working with your features you could make the ML algorithm (maybe regression or SVR or whatever) to learn this fact (that sequental races are increasing the performance of athlete). To do this you may want to drop out the date column and introduce some new column, maybe 'race number' with 0 for first race, 1 for second, 2 for third etc.

In such case regression model will be able to learn what you say 'that the second race had an effect on the athlete, which meant he performed better in the third race'. It is all about feature selection.

• Thanks, that makes sense. Would I also use the features athlete, tracktype, coach and location as factors (although, in my actual data I have hundreds of athletes, coaches (and other features))? Commented Feb 5, 2015 at 21:36
• Of course. Better to use as many features as you have at the beginning and then check bias\variance of the result - i.e split your training data into 2 sets, try to train algorithm on first subset and check the outcome on the second set. If it will 'overlearn' with specified amount of features you may want to think about dropping out one of the features (for example, coach) to check if it improves the performance of your model. Commented Feb 6, 2015 at 14:46
• You may also want to try to transform your original features in some way (like I mentioned for # of race (first second etc). For example one good idea would be to transform quantitative features (like height or weight) into cathegorical or binary features (> 6 feet and < 6 feet or 'between 60 and 70 KG, between 70 and 80 KG'). General advice is that you could get a really good results with rather simple algorithm (Linear Regression for example) but with a good selection of features. Commented Feb 6, 2015 at 14:50
• All very useful, thanks. When I start delving deeper into this I'm sure I'll be back with more questions! Commented Feb 7, 2015 at 10:51

Ok, in this case, time is your dependent variables, and all the other ones are your features.

You should use linear regression (since more complex stuff needs more expertise), any machine learning library has that implemented.

Do not use the date as a feature, those are usually lousy estimators.

• I will be performing linear regression as part of my analysis, but would like to take it further by using ML. Commented Feb 5, 2015 at 21:32