Machine learning with football · Chapter 8 · Neural networks

Interactive exercises

Build your own network on real matches, train it, and try to beat the linear model on matches it has not seen.

Estimated time: 20 minutes · page 6 of 7

Build a network

The board is a small playground. Choose the layers, the neurons per layer, the activation and the learning rate, then train. It trains on the older 80% of matches and checks on the latest 20%. Each change starts again from fresh random weights.

  1. Before training, look at the parameter count for 1 layer of 4 neurons. Work it out yourself first: 2 · 4 + 4 + 4 + 1.
  2. Set the activation to linear and train 1,000 steps. Can the map show anything but a slope?
  3. Switch to ReLU and find a network whose validation loss beats the linear model's, shown below the buttons. Google's solution for its own dataset was one hidden layer of 3 neurons, ReLU and a learning rate of 0.01. Football is noisier, so expect to search.
  4. Now try 2 layers of 16 neurons and train 2,000 steps. Watch the training loss fall and the validation loss climb, chapter 7's overfitting.

Check yourself

You add a second hidden layer after the first. Which values change for the same match, before any training?
You change the weight from home strength into the second neuron of the first hidden layer. Which values can change?

Leagues