∂Mathematics for Machine Learning
For forward deployed engineers

Is the new model really better?

You swapped the model and the score went up. Before you tell the customer, check whether the gain is real or could be luck. Set your numbers below.

Turn this on if the old and the new model were run on the very same test questions. It changes the answer more than you might expect.

Settled means: enough questions to spot a gap this size 4 times out of 5.

Try 20 questions and a score of 100%. The textbook shortcut would call that exactly 100%. The range here runs from 83.9% to 100%.

How it is worked out. Ranges: the Wilson interval, 95%. Separate questions: Fisher's exact test. Same questions: the exact McNemar test, which looks only at the questions where the models disagree. Questions needed: the standard power calculation, 80% power at the 5% level. All of these stay valid for small test sets.

Lab 1 · free · six steps

Do it yourself on a customer's test results

Six steps in Google Colab. You type each result here and the page checks it. You finish with a short report for the customer.

Start Lab 1

Three more questions a customer will ask you

"We tested it on 50 examples and it got 92%. Can we promise 90% in the contract?"

On 50 examples, a score of 92% could really be anything from about 81% to 97%.

Confidence intervals →

"The fraud filter is 99% accurate. Why does it miss half the fraud?"

When only 1 payment in 100 is fraud, a filter that flags nothing at all is 99% accurate too. Accuracy hides what matters here.

Precision and recall →
free lesson

"The detector is right 95% of the time. So a flagged message is 95% sure to be bad?"

Not if bad messages are rare. If 1 message in 100 is bad, more than 8 in 10 flags are false alarms.

Bayes' theorem and base rates →

The maths behind every answer on this page, from zero, with figures you can move.

See the course
About Pricing Terms Privacy