liveBook · Manning

Absolute error

As explained in Grokking Machine Learning, Second Edition

Absolute error is an error metric equal to the sum of the absolute vertical distances between a fitted line and the observed data points.

Absolute error measures how well a fitted line matches observed points by adding the absolute vertical distance from each point to the line. Absolute values make every distance positive, whether a prediction is above or below its observed value. section 3.20 section 3.21

Use absolute error to compare candidate regression lines:

  • Calculate each difference between the observed label and predicted label. section 3.21
  • Take the absolute value of every difference so all distances are positive. section 3.21
  • Add the distances; prefer the line with the smaller total. section 3.21

Choosing between two lines

Suppose two lines try to fit the same points. One line lies close to a few points but far from several others; the other stays reasonably close to all of them. The second line has the smaller absolute error and is preferred. section 3.21

Figure 3.18 The absolute error is the sum of the vertical distances from the points to the line. Note that the absolute error is large for the bad model on the left and small for the good model on the right.

Compare the large and small absolute-error models through their vertical distances from the data points. section 3.21

Absolute error is useful for explaining linear regression, while mean absolute error is more common in practice because averaging makes results comparable across datasets of different sizes. section 3.23

How Grokking Machine Learning, Second Edition covers it

How deep it goes
Defines absolute distances, explains model selection, and stops short of making mean absolute error the primary practical measure.
Examples
Uses competing fitted lines, vertical distance diagrams, and regression models trained on housing prices.
What it assumes
Assumes data points, labels, predictions, and fitted lines while introducing error functions through linear regression.
What you can do after
Evaluate and choose a regression line by comparing summed absolute prediction distances.
How it connects
Connects linear regression with error functions, square error, gradient descent, mean absolute error, and neural-network regression.

Also explained in

Compare how 3 books explain absolute error →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning, Second Edition. The section links point to the parts of the book it draws on.