I am working on a school project which is to create a prediction/classification model for football(soccer), and I plan to use a random forests model due since it requires a small amount of assumptions.

I'd appreciate any help for some of the issues I've run into:

  1. I plan to do this by having the result in terms of scoreline of each game as my response variable rather than simply the result, i.e. Team A 2-1 Team B (rather than W/D/L), however since I am dealing with 2 response variables (score for home team and away team), how should I work with this in the usual y~x1+x2+...+xn format?

  2. The data I have collected has features of each game that has passed, including shots attempted by the home/away team, shots on target by home/away team etc., however since these variables were only available after the game was played, I cannot use them directly as my predictors. Besides creating variables such as "average shots for home team" by taking the average of shots attempted the last n games for the home team, is there a better solution to this?

  3. I'm interested in creating a variable that tracks the form of the team, let's say "number of wins in the last n games", and I want to pick an n that would be relatively "optimal". However, if I run my model with several values of n over my out-of-sample and pick the n that has the best performance, this turns my out-of-sample data into somewhat in-sample data. Should I do the selection in-sample instead?


1 Answer 1

  1. One option is to create seperate models for each team. If you're trying to predict the score you are probably going to want to use a Random Forest Regression since you're predicting a continuous response (not Random Forest Classification)
  2. You are correct that you should only use information that you would have had before the game starts in your model. You can simply calculate your metrics for each team based after subsetting for the relevant time interval.
  3. What you can do is create three datasets: training (for fitting the random forest with different n values), testing (for testing the accuracy of the model) and validation (for out of sample comparison). Alternatively, you can use cross-validation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.