Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Online Courses / University Track / Learning from Data

Module 2 · Wrap-up

Discussion prompt, recap and references

Reflect on one question, review the module and find the named sources.

  • 25 minutes
  • Recap
  • References

Real-world case: A flu predictor that a simple baseline beat

2008 to 2014 · Search-based flu estimates and official surveillance

In 2008 a web company launched a service that estimated how much influenza-like illness there was in the United States by counting how often people searched for flu-related terms. It was trained to match the figures published by the national disease-control agency, which come a week or two late. For several seasons it was held up as a model of what large amounts of data could do.

In February 2013 the journal Nature reported that the service was predicting more than double the proportion of doctor visits for influenza-like illness that the agency reported. A later review in Science found that it had missed high for 100 of the 108 weeks starting in August 2011. It also found that, even earlier, its accuracy was not much better than a simple projection forward from the agency's own data a couple of weeks old, and that later the simple projection did significantly better.

The reviewers explained that the system had so many candidate search terms and so few flu seasons that it had fitted peculiar patterns, such as searches about high school basketball that happened to move with the flu.

How the case shows what you learned in this module

Module ideaIn the case
A baseline was availableLast fortnight's official figure, used as this week's prediction, needed no model and was hard to beat.
Error was measured too lateLarge, one-sided errors were found only after they had been running for months.
A good fit is not a good forecastMatching past seasons well did not mean predicting new ones well.
Direction of error mattersMissing high in almost every week showed a bias, not random noise.

Workplace takeaway. Report a model's error beside the simplest sensible baseline, on cases it has not seen, and watch the direction of the errors as well as their size.

Sources: Lazer, Kennedy, King and Vespignani (2014), The Parable of Google Flu: Traps in Big Data Analysis, Science 343:1203-1205; Network Science Institute summary of the paper

Discussion prompt

20 minutes. Choose a prediction used in your work or study. In 150 to 200 words, say how its error could be measured (MAE, RMSE or accuracy), which baseline it should be compared with, and what improvement would make it worth using.

Private: nothing you type here is sent or stored.

This course has no discussion board yet, so the prompt is a private reflection.

Recap

  • Error is predicted minus actual; the sign gives direction and the absolute value gives size.
  • MAE and RMSE summarise error; RMSE counts large errors more.
  • Accuracy for categories depends on class balance; the majority baseline sets the level to beat.
  • Always compare a model with a simple baseline on the same cases.

Flashcards: 12 workplace review cards

Tap a card to reveal the answer. Read the question, answer it aloud or in writing first, then check yourself against the explanation.

Card 1 of 12 · What is the error of a prediction?
Predicted55Actual50Error+5
Error

Predicted minus actual. A forecast of 55 when the true value is 50 has an error of +5. In a delivery service, a quote of 30 minutes for a 40-minute trip has an error of −10.

Card 2 of 12 · What does the sign of the error tell you?
+too high−too lowSame signbias
Sign

Positive means over-prediction and negative means under-prediction. A consistent sign is a bias, such as a price model that is always too high.

Card 3 of 12 · What is absolute error?
−15becomes 15SizeonlyUsein averages
Absolute error

The size of the error without its sign. It is used so that errors of opposite sign do not cancel when you average many predictions.

Card 4 of 12 · What is mean absolute error (MAE)?
Addabs errorsDivideby countUnitsof label
MAE

The average of the absolute errors. If five homes are missed by 10, 5, 10, 5 and 10 thousand, MAE is 8 thousand. It is in the units of the label.

Card 5 of 12 · What is root mean squared error (RMSE)?
SquareerrorsMeanof squaresRootof that
RMSE

Square the errors, average the squares, take the square root. Large errors count more, so it suits cases where a big miss is especially harmful.

Card 6 of 12 · When do MAE and RMSE differ most?
Equal errorssameOne big missRMSE higherChooseby cost
MAE vs RMSE

When one error is far larger than the rest. Errors 2, 2, 2, 2, 12 give MAE 4 but RMSE about 5.7.

Card 7 of 12 · What is accuracy?
Right17All20Accuracy85%
Accuracy

The share of predictions that are right: correct predictions divided by all predictions. For categories, such as renews or not.

Card 8 of 12 · Why can high accuracy mislead?
Rare class1 in 100Always no99%Findsnobody
Class balance

If one class is common, always predicting it scores high. A test for a condition that 1 in 100 has can be 99% accurate and find nobody.

Card 9 of 12 · What is the majority baseline?
PredictcommonestNeedsno modelBeatit
Majority baseline

Always predict the most common class. It needs no model and sets the accuracy any real model must beat.

Card 10 of 12 · What is a baseline?
NumbersmeanClassescommonestSerieslast value
Baseline

The simplest sensible way to predict: the mean for numbers, the commonest class for categories, the last known value for series over time.

Card 11 of 12 · How do you report improvement over a baseline?
Baseline24Model8Improvement67%
Improvement

(Baseline error minus model error) divided by baseline error. A model error of 8 against a baseline of 24 is a 67% improvement.

Card 12 of 12 · Why must the model and baseline use the same cases?
SamecasesUnseenby the modelThencompare
Fair test

Otherwise the comparison is unfair, because one may have easier cases. Use cases that were not used to fit the model.

Module notes

Key terms. Error: predicted minus actual. Absolute error: the size of an error. MAE: mean absolute error. RMSE: root mean squared error. Accuracy: share of predictions that are right. Baseline: the simplest sensible prediction. Majority baseline: always predicting the most common class. Improvement: baseline error minus model error, divided by baseline error.

Rules and formulas. error = predicted − actual; MAE = mean of |error|; RMSE = √(mean of error²); accuracy = correct ÷ all; improvement = (baseline − model) ÷ baseline.

Limits of this module. The examples use small invented tables so that every figure can be checked by hand. Real evaluation uses many more cases, a separate test set (Module 5) and measures suited to the cost of different mistakes (Module 6).

Next

Continue to Module 3: Fitting a Line: Regression. You can also return to the course overview or the University Track.

References and further reading