Machine learning with football · Chapter 8 · Neural networks

Nodes and hidden layers

Inputs, hidden neurons, an output, and the weights between them. Every neuron is a small linear model.

Estimated time: 15 minutes · page 2 of 7

Neurons in layers

Draw a linear model as a diagram and you get input nodes, here home and away strength, each joined to one output node by a weight. The output is the weighted sum plus a bias. That's chapter 2's model in a new picture.

A neural network puts hidden layers between input and output. Each node in them, called a neuron, computes its own weighted sum of the layer before, plus its own bias, exactly like a small linear model. The next layer takes those values as its inputs. The board draws the network for one match, with each node's value. Thicker lines are bigger weights, bright lines positive and grey ones negative.

Parameters add up fast. Every neuron has one weight per input plus a bias, so a layer with n inputs and m neurons has n · m + m parameters. With 2 inputs, 4 hidden neurons and one output that's 2 · 4 + 4 = 12 for the hidden layer and 4 + 1 = 5 for the output, 17 in total. The board counts them for the shape you pick.

Now set the activation to linear. However many neurons you add, the map stays a plain slope. A weighted sum of weighted sums is still a weighted sum, so a network built only from linear steps is one big linear model. The next page fixes that.

Check yourself

A network has 3 inputs, one hidden layer of 4 neurons and 1 output. How many weights and biases?
With linear activations everywhere, can that network learn a nonlinear pattern?

Leagues