Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 01 · Portfolio Projects · Build It Yourself · about 19 min to read

Play it as a journeyTutor comes with a plan

P6: A model you can defend

S1 - Build Your Own Database
S1 - Build Your Own Database · Open board

The board shows rows being written into a store and read back. A model for a table starts from the same thing: rows, each one a record, and the care you take over which rows are used for what.

In June 2021 a team at Michigan Medicine, led by Andrew Wong, published a test of a widely used sepsis warning model. Sepsis is a dangerous reaction of the body to an infection, and an early warning can save a life. The team checked the model on 27,697 patients and 38,455 hospital stays between December 2018 and October 2019. The score that measures how well a model separates sick from not sick (called AUC, where 0.5 is a coin toss and 1.0 is perfect) came out at 0.63. The vendor had reported a higher range, 0.76 to 0.83. The lesson is not that the model was useless. It is that a score reported by the builder is not the same as a score measured by someone else on their own patients.

You are about to put a model in your portfolio. A hiring engineer will ask one question of it: “how do you know it works?” By the end of this lesson you will be able to build a small model on a table of rows, score it honestly, catch two kinds of leakage, and write the one page that lets a stranger trust your number.

The history (optional)

The Michigan study is Wong et al., “External Validation of a Widely Implemented Proprietary Sepsis Prediction Model in Hospitalized Patients”, JAMA Internal Medicine, published online 21 June 2021. Epic, the vendor, disputed how the study defined sepsis. The study’s conclusion was that the model had poor discrimination and calibration. A one-page report that states what a model was trained on and where it fails, called a model card, was proposed by Margaret Mitchell and colleagues in 2019.

Before you start. You need Honest scores: cross-validation, leakage and bias-variance, which gave you the training, validation and test piles, cross-validation and the idea of leakage. You need Trees, forests and boosting, where a decision tree asked yes-or-no questions about columns, and Precision and Recall (where to set the spam filter's bar), which gave precision (of the ones the model flagged, how many were right) and recall (of the real cases, how many the model found). You need A repo a stranger can judge in two minutes, which says what a good project folder contains. This lesson fills the model part of that folder.

Lesson 13 of 19 in Portfolio Projects

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • The project: which customers will leave next month
  • A baseline: the score a model that does nothing gets
  • Choose the model on validation, then open the test once
  • Leakage 1: a column that is only known after the answer
  • Leakage 2: the same customer on both sides
  • What goes on the one page
  • The whole experiment
  • Reading the output
  • Edge cases and trade-offs

Terms it explains: baseline, leakage, compaction, log-structured, offset, WAL.

Review Portfolio Projects