Skip to content

Start with a task contract

Write down what a model is for before you see a score. The decision, the population, the unit, the timing and the cost of each error decide which split, metric and threshold are honest.

Applied ~12 min9 steps

You will be able to

  • Turn a vague goal into a testable target with a population, unit and horizon
  • Derive the cost-based threshold from two error costs and say when it fails
  • Tell the row from the independent unit, and pick the split that matches the question
  • Fill in Predict's task contract and read its fingerprint

Read first

01

"Predict churn" is not a task

Read

"Predict churn" can't be tested. "Predict whether an active customer cancels in the next 90 days, using what we know on Monday morning, so the retention team can call the riskiest 500" can. The second version names a population (active customers), a target (cancels within 90 days), an information time (Monday morning), a decision (who gets a call) and a capacity (500 calls).

A task contractTask contractWhat a model is for, written before results: use, population, unit, horizon, success, failure, loss and fallback. is that sentence, written down before you see any score. Every later choice, from the split to the metric to the threshold, either follows from it or quietly changes the question.

02

Seven things to pin down

Read
ElementWhat to writeWhat it decides
Intended useThe action the output supports, and who takes itWhich errors matter
TargetThe estimandEstimandThe exact quantity an analysis targets, such as a difference in means or a ratio of medians., horizon or ranking task, with unitsThe outcome column
PopulationWho is in, who is out, where and whenWhich rows are eligible
UnitPerson, document, speaker, site or time blockHow to split and resample
Information timeWhat is known when the prediction is madeWhich features are allowed
SuccessThe primary metric and the gain that would matterThe comparison rule
FailureUnacceptable errors and the fallbackWhat to check by slice
03

A threshold from two costs

Read

When a calibrated probability pp drives a yes-or-no action, a false positive costs CFPC_{FP} and a false negative costs CFNC_{FN}, acting is cheaper on average when

p>CFPCFP+CFN.p > \frac{C_{FP}}{C_{FP} + C_{FN}}.

If a wasted call costs 1 and a missed churner costs 9, the threshold is one in ten. Note what the rule assumes: the two costs describe the decision, the probabilities are calibrated, and nothing else limits you. A cap of 500 calls, benefits that differ by customer or delayed outcomes all change the rule. Set the threshold on development data, never by looking at the final test set.

04

Rows are not units

Predict

Predict first

A dataset has 1,000 video frames from 10 videos, and the model will be used on new videos. How many independent observations does a test score rest on?

About 1,000 independent observationsAbout 10 independent observations
Reveal

About 10. Frames from one video share the scene, lighting and camera. A model can score well on held-out frames by recognizing the video. The question is about new videos, so the split, the resampling and the reported count must all work at the video level.

05

Which split answers which question?

Read

Decide whether you are predicting new rows from familiar unitsEvaluation unitWhat varies independently and must not sit in both training and test data: a patient, molecule, speaker, site or forecast origin., new units, new sites or a later period. They are four questions with four splits:

  • New rows, same units: a random split can be fine.
  • New units (patients, customers, speakers): split by group, so a unit's rows never sit on both sides.
  • New sites or devices: hold out whole sites and report them separately.
  • The future: train on the past and test on a later period.

Report both counts: rows and independent units. A thousand rows from twenty customers is a small study.

06

Association is not intervention

Reflect

A model that predicts churn well doesn't tell you what a discount would do. An explanation of what moved the score doesn't tell you what would happen if you changed that variable in the world. Those are causal questions, with their own designs and assumptions.

Look at the last model you were asked to build. Was the question "who will churn?" or "what would stop them?" Which one did the contract say?

07

The contract in Predict

In the app

In Predict's Setup step, open Task contract ("What the model is for, written down before you see results"). It has eleven fields: Use, Target, Population, Unit, Horizon, Information time, Decision owner, Success, Failure, Loss and Fallback. All are optional, and each shows an example.

When you save, the app computes a contract fingerprintContract fingerprintA blake3 hash of the task contract's filled-in fields; any wording change gives a new fingerprint. (a blake3 hash of the filled-in fields). Every new run records it, so you can tell which runs were made under which contract. If you edit the contract after the test set has been revealed, the edit goes into the evaluation ledger and the panel shows "Changed after the test reveal". The model card copies the contract into its own section.

08

Check: task contracts

Checkpoint

Check yourself

Which goal is a testable target?

Show the answer

Answer: c

It names the population, the outcome, the horizon and the information time, so a split, a metric and a test can follow from it.

Check yourself

A false positive costs 1 and a false negative costs 4. With calibrated probabilities and no other limits, above what probability should you act? Give a decimal.

Show the answer

Answer: 0.2

1/(1+4)=0.21 / (1 + 4) = 0.2. Acting is cheaper on average once the chance of the costly miss passes one in five.

Check yourself

The retention team can make only 500 calls a week, and the cost rule flags 2,000 customers. What does that tell you?

Show the answer

Answer: b

The formula assumes you can act on everyone above the line. A capacity limit turns the decision into a ranking, which the contract should state.

Check yourself

A clinic dataset has 4,000 visits from 600 patients. The model will be used on new patients. What is the unit for the split?

Show the answer

Answer: b

The question is about new patients, so all of a patient's visits must stay on one side of the split. Report 600 patients alongside 4,000 visits.

Check yourself

You change one word in the task contract after revealing the test set. What does Predict do?

Show the answer

Answer: c

Any wording change gives a new fingerprint. Edits after a reveal are allowed, but they are logged and shown, because the contract may have been bent to fit a result.

Check yourself

A churn model ranks "no discount last quarter" as its strongest feature. What does that support?

Show the answer

Answer: b

A predictive association isn't an intervention effect. A causal claim needs a design (an experiment or an identification argument) of its own.

09

Recap

Recap
  • Write the contract first: use, target, population, unit, information time, success and failure.
  • Two error costs give the threshold CFP/(CFP+CFN)C_{FP}/(C_{FP}+C_{FN}), if calibration holds and nothing else limits you.
  • Split and resample at the independent unit, and report rows and units.
  • Predict's Task contract is optional, hashed, stamped on every run, and logged when edited after a reveal.

Concepts in this lesson