How many points is a goal worth? We teach a computer to answer that from the league table, one idea at a time.
Estimated time: 10 minutes · page 1 of 7
The question
Teams that score more than they concede win more points. Obvious. But how many more? Linear regression answers that by drawing the straight line that fits two numbers best, and here both numbers come from every team in the table. Goal difference per game is what we know, so it's the feature, written x. We want points per game, the label, written y.
Each team gives one pair of x and y, one example, so a league hands us about 20. Per-game numbers keep a team with a game in hand comparable. Every dot on the board is one team, and you can switch leagues at the top of it.
The model
A straight line has two numbers you can turn:
y′ = w · x + b
y′ is the prediction, the model's guess at points per game. The weight w is the slope: how many extra points per game one more goal of difference per game is worth. The bias b is where the line crosses the middle, so it's the prediction for a team with goal difference 0.
Together, w and b are the model's parameters. Training means finding the pair that fits the examples best, and you can try it by hand first. Move the sliders until the line runs through the dots.
Check yourself
More than one feature
Goal difference is one number. A model can use several, each with its own weight. With goals for per game as x₁ and goals against per game as x₂, the line becomes:
y′ = b + w₁ · x₁ + w₂ · x₂
Add shots, xG or possession and you get more terms of the same kind, y′ = b + w₁x₁ + w₂x₂ + … + wₙxₙ. Training still only turns the weights and the bias. Some books write the bias as w₀, because it works like a weight on a feature that is always 1. You train a two-feature model yourself on the last page of this chapter.
Before any of that, a line needs a score, so the computer can tell a good one from a bad one. That score is the loss, on the next page.