~/teaching · machine learning · homework 1
Framing a machine learning project before any code: the question, the decision, the target and a six-line scope document
The first milestone of the course project, written as a guide you can apply to any data project, followed by a short method for proving a baseline
Abstract
Most data projects that fail do not fail on the model. They fail earlier, because nobody wrote down who would act on the prediction, what a mistake would cost, or which column was supposed to be predicted and when its true value becomes known. This note summarises the brief of the first milestone of the team project in the Machine Learning course at Centrale Méditerranée (option DDEFI, 2026-2027): before any code, each team frames its own topic in a short Markdown file, docs/cahier-des-charges.md, kept in the shared repository.
The file opens with the question in a single sentence, then follows the six-line template of the course's open data projects deck: the decision, the target, the metric, the safeguards, the data and the plan, and closes with "who we are": first the persona, the company the team plays for its project (a consulting firm, a bank's in-house data team, a fintech's risk department), then a short profile of each real member. Two examples show what a complete file looks like, a fictional parcel-delivery team and a file filled in on the public Home Credit Default Risk credit data, and a checklist closes the framing part.
A second, shorter part gives the method for proving a baseline on the course's common thread, the public UCI credit default data: a constant reference, two models written by hand, a two-page note from decision to expected cost, a pre-registered ablation and the usual pitfalls. Class arrangements are left out; what remains is a method you can reuse on any project.
Plan of the deck
- What the team writes. One Markdown file in the repository: a question, six template lines, a persona and a team profile.
- A filled example: credit risk. The whole file on the public Home Credit Default Risk data, written for a fictional consulting firm.
- The question in one sentence. Four markers that turn a vague ambition into something someone can act on.
- Decision, target, metric. Who acts and what errors cost, a dated target that rules out leakage, a metric in the decision-maker's units.
- Safeguards, data, plan, team. What the model must never do, a source you can open today, three models to compare, who does what.
- A complete example. A fictional parcel-delivery agency, line by line, with why each line holds.
- Before handing in. A checklist and the neighbour test: a reader from another team restates the question.
- Practice on the common thread. Baseline, from-scratch models, the baseline and threshold note, ablation, decision log, AI appendix, pitfalls.
The question, in one sentence
A useful question names a decision, a way to measure success, a scope and the person who will act on the answer, all in one sentence.
"Use AI for logistics" is an ambition, not a question: nobody can tell whether it has been answered. The framing method of the course, introduced in its first session (frame before you model), asks for a sentence with four markers. A decision: something that will be done differently depending on the answer. A measure: how we will know the decision improved. A scope: which population, which place, which period. An owner: a role that will actually act on the prediction.
| Marker | Question it answers | Parcel-delivery example |
|---|---|---|
| Decision | What changes with the answer? | Have the customer phoned, or not |
| Measure | How do we know it worked? | Late deliveries avoided, calls wasted |
| Scope | On what, where, when? | One depot, tomorrow's parcels |
| Owner | Who acts? | The operations manager, each evening |
On the course's common thread, the owner was a credit analyst who reviews applications; in the fictional example used throughout the brief, it is the manager of a delivery depot who decides, each evening, which customers to call so that tomorrow's drop-offs go smoothly. If the question needs two sentences, it usually hides two decisions, and the team should pick one.
Remark (The test of the copied sentence). A good question is specific: pasted into another team's file, it would make no sense there. A sentence that fits any topic is not yet a question.
The decision and what each error costs
Write who decides, what the real options are and when the choice is made, then put a price on acting for nothing and on failing to act.
The decision comes first because it fixes everything that follows. Name a role rather than a person (an operations manager, a credit analyst, a buyer, an emergency dispatcher) and the moment at which that role acts, because that moment decides which information the model may use. Then list two or three concrete options that the prediction can tip one way or the other.
Every decision has two ways of going wrong: acting when it was not needed, and not acting when it was. They almost never cost the same. Writing both prices down, even roughly, is what later lets you choose a threshold instead of accepting 0.5 by default. "Understanding delays better" is not a decision, since nobody behaves differently whatever the answer; a project without an identifiable decision-maker tends to end as a demo with nothing at stake.
- Who: a role and the deadline by which it acts.
- What: the real options, the ones the prediction can change.
- False alarm: the cost of acting for nothing (a wasted call, a refused good client).
- Miss: the cost of not acting in time (a complaint, a default accepted).
A dated target, and the leakage it rules out
The target is a column recorded by a rule at a known date, and anything that happens after the moment of prediction is forbidden as an input.
A target is not the phenomenon itself but a dated trace of it, recorded according to a rule. The scope document gives four facts: the exact column name and how it is computed, the horizon of the prediction, and the date at which the true value is known. For the delivery example: late equals one when a parcel arrives after the promised slot, predicted the evening before, known on delivery.
Those dates are the main protection against data leakage. A target that is already known before the decision is suspicious, and any variable recorded after the moment of prediction must not be an input: in the example, nothing that happens during the next day's round. The decision threshold and reproducible ML note shows how a leakage map, column by column, makes this check systematic.
Add one sentence on what the column does not capture. In the example, an absent customer is counted as late, and one minute late weighs as much as a day. This is not modesty: it stops the team from promising the decision-maker more than the column actually measures.
A metric that measures the decision, and safeguards you can check
Judge the model in the units the decision-maker reads, set the level at which it becomes useful, and list what it must never do even if it would score better.
The metric that matters is the one that says whether the decision got better: an expected cost in euros, hours saved, delays avoided for a given number of calls. Write the usefulness threshold too, the level at which the model beats doing nothing, or beats the simple rule already in place. Then name the model metric that tracks it on the validation set: log-loss or Brier score for probabilities, PR-AUC for a rare class, mean absolute error for a quantity.
Remark (Why accuracy alone is a trap). If 4 % of parcels arrive late, the rule "never late" is right 96 % of the time and prevents no delay at all. On an imbalanced problem, accuracy rewards the model that ignores the minority class.
Safeguards state what the model must never do. They come in three families: forbidden variables (a protected attribute, directly identifying personal data), people to protect (a group that an error would hurt more than others) and leakage (anything known after the decision). On the credit thread, sex was excluded while marital status and age were audited. A safeguard is worth writing only if it can be verified in the code or in the data, and it is more credible when a named role signs it and has the power to stop the model.
Data you can open today, a plan with three models, and the team
Name a source you can open now with its licence, period and gaps, plan a naive, a better and a heavy model, and say who is on the team.
The data line sinks more projects than any other, because teams fill it in last. It needs an address that works today, not "we will ask the company"; a licence that has been read and suits a public student project; the period covered and the number of rows, which tells you whether a split by date is possible; and an honest list of what is missing: the column you wish you had, gaps, known collection biases. If access depends on a third party, write when you expect it and name an equivalent public fallback. The open data projects note lists sources and shows how to read a licence quickly. A line you cannot fill in this week is a reason to change the topic, not the model.
The plan, in three models
- Naive. The reference to beat: a historical rate, an average, or the business rule already in use.
- Better. The best reasonable model, often a regularised linear or logistic regression.
- Heavy. A more complex model, such as gradient boosting, that tests whether complexity actually pays.
The plan also says what should exist at each later milestone and who does what, with three roles (data, model, review) that rotate. It is not a binding commitment: the plan will change, and the file history will show how. The brief ends the template with who we are, in two parts. First the persona: the company the team plays for the project, whether a consultancy working for a bank, the data unit inside a bank, a fintech's risk function or the quants of a credit fund, with its client or counterpart and the person who signs off. Then a short team profile of the real people, one line per member written by that member: background, the job they are aiming for (an honest "not sure yet" is fine), why they chose this track and their interests. The persona tells everyone on whose behalf the team speaks; the profiles are used to assign roles, to ask each person questions close to their future job, and to connect the project with their applications.
Two worked examples: a parcel-delivery agency and credit risk
A fictional delivery team shows a complete file and how two error prices give a threshold; a file filled in on public credit data shows the same template on a finance topic.
The brief fills the whole template for an imaginary team, with imaginary figures: read the form, not the content. The manager of one depot decides each evening, before a fixed cut-off, whether to have a customer phoned. A wasted call is priced at 8 euros and an unannounced delay at 25 euros, because it triggers a complaint. The target is dated after the decision, the metric is an expected cost per evening, the safeguards forbid refusing a delivery and using any personal data of the recipient, and the data line names an anonymised export of past rounds, a written access request and a public fallback with its licence, plus the missing weather, to be joined by date and town.
In words, with the example's prices (illustrative figures)
- Two prices. A false positive is a call for nothing (), a false negative is a missed delay (), and a correct decision is counted as free.
- Compare. Calling a parcel with delay probability costs on average and not calling costs , so calling is worth it when .
- Threshold. That happens when exceeds about 0.24, provided the probabilities are calibrated, which is why the metric line also names log-loss.
- Naive reference. With 4 % late parcels, never calling costs euro per parcel and calling everyone about 7.7 euros (), so the model is useful only below 1 euro.
Credit risk on Home Credit Default Risk
The brief also fills the template on a real dataset: Home Credit Default Risk, a 2018 Kaggle competition built on data from a consumer lender whose clients often have a thin credit history or none at all. The persona is invented: Aurore Data Conseil, a data consulting firm working for the lender's risk department, whose director signs off the threshold. The question asks which of the month's applications a credit officer should route to a manual review, so as to cut defaults while turning away no more good clients than today.
| Line | What the file says |
|---|---|
| Decision | Grant, refuse or send to manual review; a default costs far more than a good client turned away, and the ratio between the two is agreed with the risk director. |
| Target | The competition's TARGET column, 1 when payment difficulties show up on the first instalments; predicted when the application arrives, known only several instalments later; silent on euro losses and on late defaults. |
| Metric | Area under the ROC curve, the competition metric, plus PR-AUC because defaults are rare; in business terms, an expected cost per application at the chosen threshold, worth deploying only if it beats the current rule. |
| Safeguards | Gender left out, age audited for non-discrimination, nothing recorded after the application, no directly identifying data, and a human takes the final decision: credit scoring of individuals is listed as high risk in Annex III of the AI Act. |
| Data | About 307,000 applications in the main table, plus credit bureau records and earlier applications, used under the competition rules; recovered amounts and the economic context are missing. |
| Plan | A naive threshold on one of the external scores, then a logistic regression, then gradient boosting with LightGBM; data, model and review roles that rotate. |
- Before handing in, check that the question carries its four markers, the decision has a role and both error prices, the target has a horizon and a date of knowledge, the metric has a usefulness threshold, each safeguard can be verified and the data line has a source, a licence, a period and its gaps.
- Check that the plan, the persona and the team profile are written, and that the file is pushed to the main branch of the shared repository.
- The neighbour test: someone from another team reads the file without any explanation and restates the question, the decision, the target and the metric. Any hesitation means that line needs rewriting.
Practice: proving a baseline on the common thread
On public credit data, a team can rehearse the method the next milestone will apply to its own project: a reference, a note, an honest ablation.
The second part of the brief is recommended practice on the credit default common thread (UCI Default of Credit Card Clients, Yeh and Lien, 2009). It rehearses what the next milestone asks on the team's own data. A baseline is the simple, honest model that any candidate must beat by a measured margin. The first reference is the constant model that predicts the base rate , about 22.1 % defaults, for every client; its scores can be computed by hand.
Six pieces, in the order to open them
- A rerunnable repository. Code, tests, a lockfile, continuous integration and one command that goes from the raw CSV to a metrics file.
- Two models by hand. Least squares by the normal equations and by SVD (least squares), logistic regression by gradient descent (logistic regression), each compared with scikit-learn, gap printed.
- A two-page note. Page one: framing, data, frozen split, leakage map. Page two: the model against the constant, calibration with a reliability curve, the cost-based threshold and what happens if costs move by a fifth.
- A pre-registered ablation. Predict what is lost without each group of columns, file the prediction as a timestamped issue, compute on validation with the test set sealed, comment each gap.
- A decision log. Dated entries with the rejected alternative and the command that proves the figure.
- An AI appendix. Each use with its level, and two assistant claims proved wrong by a failing test, a computation or a figure.
The note copies the outline a bank's model committee reads: an independent validation team reruns the figures from the repository, then looks for the leak, the unjustified threshold, the uncalibrated probability, before the committee approves, approves with conditions or refuses. Every figure in the note must come from the metrics file. Four pitfalls recur: a scaler fitted on the whole CSV before the split (a test compares its stored mean with the training fold), an AUC computed on hard labels instead of probabilities, random seeds scattered across notebooks instead of one configuration file, and a README that only runs on its author's machine, caught only when someone else clones the repository and follows it.
Key takeaways
- Write the question in one sentence with a decision, a measure, a scope and an owner; if it needs two sentences, pick one decision.
- Name who decides, when, between which options, and price both errors: acting for nothing and failing to act.
- Date the target and the moment of prediction: anything recorded after that moment is leakage and cannot be an input.
- Measure the decision in the decision-maker's units, with a usefulness threshold, and never rely on accuracy alone for a rare class.
- Write safeguards that can be checked, a data source you can open today with its licence and gaps, and a plan with a naive, a better and a heavy model.
- Prove a baseline with a constant reference, models written by hand, a traceable note and an ablation whose predictions were filed first.
- Say who you are: the company the team plays, its client and who signs off, then the real people behind it.
Glossary
- Scope document
- A short file that states the question, decision, target, metric, safeguards, data and plan of a project.
- Problem statement
- The question a project answers, written so that someone can act on the answer.
- Decision owner
- The role that acts on the prediction, at a known moment.
- Expected cost
- The average cost of the decisions taken with a model, weighting each error by its price.
- Usefulness threshold
- The level at which a model becomes better than doing nothing or than the existing rule.
- Prediction horizon
- The time between the moment of prediction and the event predicted.
- Data leakage
- Information unavailable at decision time that reaches the model and inflates its scores.
- Safeguard
- Something the model must never do, stated precisely enough to be verified.
- Team persona
- The company a project team plays for its project, with its client and the person who signs off.
- Accuracy
- The share of correct predictions; misleading when one class is rare.
- Baseline
- The simple reference model any candidate must beat by a measured margin.
- Ablation study
- Removing groups of inputs one at a time to measure what each contributes.
- Pre-registration
- Writing predictions down, timestamped, before running the experiment.
The other notes of the course
One public summary per deck, in the order of the course.
Previous: Decision threshold and reproducible MLNext: Kernels, SVM and decision trees
- IntroductionAI winters, jobs and method
- ToolsKaggle, GitHub, Python: the tools
- Session 1Project framing and least squares
- Session 2Maximum likelihood and logistic regression
- Session 3Gradient descent, ridge and lasso
- Session 4Decision threshold and reproducible ML
- HomeworkFraming an ML project: the scope document
- Session 5Kernels, SVM and decision trees
- Session 6Forests, boosting, honest comparison
- Session 7SHAP, fairness, PCA and clustering
- HomeworkA simple model with a complete method
- Session 8Neural networks, drift, conformal prediction
- HomeworkA delivered machine learning project
- Session 9Defending a machine learning project
- ReferenceCredit default scoring project
- ReferenceAsset returns: XGBoost and sentiment
- ReferencePython code for every ML model
- ReferenceDeep learning essentials
- ReferenceOpen data ML projects by sector
- ReferenceData and AI engineer handbook
- ReferenceData engineering, SRE and cloud
- ReferencePanorama of machine learning models
About these notes
Written by the lecturer from the slides of the deck, as a public summary: the key ideas, the formulas and one worked example. The exercises, their solutions, the tests and the grading stay in the deck, for the students of the course.
Revision: .