Case study, part 2: tasks 9 to 14, hand-in, and the debrief
The Python node the subject demands, explainability, model comparison, the quality report, ethics, the temporal split bonus, and an honest comparison with Orange
Objectives
By the end of this session you will be able to:
- Use the Python node when, and only when, the subject requires it
- Turn permutation importance into an explanation for a non-specialist
- Compare two models on the metrics the marking scheme names
- Produce a data quality report as a deliverable, not as a screenshot
- Write ethics and limits that say something
- Finish with a temporal split on a sealed test set, and hand in the report
Prerequisites
- A rakoon-ds account on https://rakoon-ds.apps.way-up.io (free, browser only, nothing to install), and the group join code your instructor gives you
- A recent Chrome, Edge or Firefox. Computation runs either in your own tab (browser engine) or on the server; the header pill tells you which
- Session 14 finished, in the same project, with steps 1 to 8 green
- Your instructor has the progress page open
- Transformation, chart and algorithm names come from the rakoon-ds registry and are served in French even when the interface is in English. Every step below gives you the French label you will click and, in
code font, the registry key the mission checks against.
Data
The SNCF lost-property exam pack. Seven files, all semicolon-separated and UTF-8.
| File | Rows | What one row is |
|---|---|---|
objets-trouves-restitution-2019 to -2022 | 88 263 + 47 350 + 61 989 + 61 300 = 258 902 | one lost item, 7 columns |
liste-des-gares.csv | 4 144 | one station and one railway line: 3 471 distinct stations |
frequentation-gares.csv | 2 967 | annual traffic per station |
departements-regions.csv | 94 | department, region, school holiday zone |
holidays.xml | 1 609 <row> | one date and one zone, 607 distinct dates |
The files are not shipped with rakoon-ds: the platform delivers the mission, not the data. Get them from your instructor, folder Content/exams/data-exploration-preparation/2026f/. Public equivalents: SNCF open data (data.sncf.com: lost property and returns, station list, station traffic) and data.gouv.fr for regions and school holidays.
Two traps announced in the subject itself. First, the timestamps carry a variable UTC offset (+01:00 in winter, +02:00 in summer): an item recorded at 11:47 must not become 09:47. Second, the UIC station code has ten characters in the lost-property files (0087474007) and eight everywhere else, and the station list has several rows per station, so a naive join multiplies rows.
Timing
The steps below add up to the announced duration. If you fall behind, Step 1 to Step 3 are the ones that must be finished.
| # | What you do | Time |
|---|---|---|
| Step 1 | Task 9: the Python node, because the subject says so | 15 min |
| Step 2 | Task 10: importance, and one explanation | 15 min |
| Step 3 | Task 11: compare two models, on the right metrics | 15 min |
| Step 4 | Task 12: the quality report as a deliverable | 12 min |
| Step 5 | Task 13: ethics and limits, with something in them | 13 min |
| Step 6 | Task 14: the bonus that is worth the most | 15 min |
| Step 7 | Hand in, and the debrief | 20 min |
| Total | 105 min | |
Instructions
Step 1: Task 9: the Python node, because the subject says so15 min
The subject asks for a computed variable "using a Python Script widget". It is the only task in the whole exam that imposes a tool, and the mission checks it with transform_applied {op: "python"}.
- Family Python, card Python (IA) (
python). - The variable to build: how many items were recorded the same day in the same station. Reference: from 1 to 96, mean 11.1.
- Write the function. The sandbox gives you
pdandnp, no imports and no file access:
def transform(df):
# nombre d'objets enregistres le meme jour dans la meme gare
cle = ["Date_year", "Date_month", "Date_day", "code_uic"]
df["objets_meme_jour"] = df.groupby(cle)["Date"].transform("size")
return df
The Describe the transformation field asks a language model to write the code for you. It needs a Gemini key on the instance; without one the panel says so and you write the four lines yourself. Either way you must be able to read them.
Roughly 0.2 s on 258 809 rows. Then ask yourself the question the subject does not: is this variable available at the moment you predict? An item recorded at 09:00 does not yet know how many items the station will record by midnight. Write that down.
Step 2: Task 10: importance, and one explanation15 min
- Open your best classifier, Explanations tab.
- Permutation importance: about 4 seconds on a 2 000-row sample, baseline accuracy 0.687 for reference.
- Partial dependence on the two strongest variables, about 0.4 s each.
- Then the Predict tab, Simulator: load one item, move one variable, and use Quel changement fait basculer ?.
Write, in the Modélisation section, 500 characters minimum: which variables the model relies on, in which direction, and one concrete prediction explained end to end. No algorithm name, no jargon. The mission checks the length; your instructor checks the rest.
Step 3: Task 11: compare two models, on the right metrics15 min
- Train a LightGBM (
lgbm_clf) on the enriched dataset. Reference: accuracy 0.701, F1 0.620, AUC 0.764, about 8 seconds. - Train a Régression logistique (
logreg). Reference: 0.684 accuracy, AUC 0.740, about 4 seconds. - Open the Comparison panel from the workshop header and read the two rows side by side.
- Pour the comparison block into the Modélisation section.
These are the marking scheme numbers, found: it expects accuracy around 0.70, F1 around 0.60 and AUC around 0.76, and the studio produces 0.701 / 0.620 / 0.764. If your numbers are far from these, something upstream is wrong, and the most likely culprit is a join.
The two ROC curves cannot be superimposed on one chart: you get one per model. Put the two AUC values in a table instead and say so. Claiming a figure you did not produce is the fastest way to lose the marker's trust.
Step 4: Task 12: the quality report as a deliverable12 min
- On your enriched dataset: Explore → Quality, target
returned. About 0.2 s on 258 809 rows and 21 columns. - Read and record: 2 924 duplicate rows, one constant column, the outlier columns, and the class balance.
- Find the station that did not match the join: Boulogne Ville, 638 items. One station out of 156, and the reason is in the station file, not in your chain.
- Pin the profile (Statistics tab, Pin) and pour it into the Données section.
- Write 600 characters: missing values by column, duplicates, the unmatched station, and what you did about each.
One honest limitation to know before you rely on it: the profile is computed on a sample of 100 000 rows above that size, so a count read off the profile is an estimate. On this dataset the profile reports 37 missing stations where the true number is 93. The Quality tab says when it has sampled. Read the flag before quoting a number.
And the reverse limitation: the Quality tab does not detect leaks. Leak detection happens at training time, on the pair (dataset, target). A student who only explores will never see the warning. That is a design choice, it is coherent, and you need to know it.
Step 5: Task 13: ethics and limits, with something in them13 min
Write the Conclusion et limites section, 700 characters minimum. Answer these, specifically, about this model:
- Who would use this prediction, and to decide what? (the subject says: to organise storage and communication)
- What happens to an item the model says will not be returned? Does the prediction become self-fulfilling?
- Which variables would you refuse to use even if they improved the score, and why? (station, department, region are proxies for something)
- The 2020 collapse is in your training data. What does that do to a model deployed in 2027?
- What is the cost of a false positive against a false negative here, and does your metric reflect it?
- What would you monitor after deployment?
"We would need more data" is not a limit, it is a reflex. Every one of the six questions above has a specific answer on this dataset. The marking scheme gives this task real weight, and so does the mission: 700 characters is roughly twelve lines.
Step 6: Task 14: the bonus that is worth the most15 min
Two enrichments, and the second one is the one that changes the exercise.
- Time bands. Catégoriser (seuils) (
categorize) on the hour, thresholds and labels of your choosing. One transformation. - Temporal split with a sealed test set. Filtrer des lignes (
filter_rows) to build a 2019 to 2021 training set and a 2022 test set. Sceller the 2022 one. Then train with that sealed dataset as Jeu de test. - Compare with your random-split score. This is Session 8, on a real exam.
The subject does not ask for this, and the marking scheme rewards it anyway. Every dated dataset in this course has told you the same story: on the air passengers exam the random split announced R² 0.8837 where the truth was 0.7148; on the bike dataset of Session 8, 0.8889 against 0.6167. Do not hand in a random-split number on a dated dataset without saying what it is.
Step 7: Hand in, and the debrief20 min
- Fill any of the seven sections still empty. The mission checks all of them by length; read mode shows you the gaps.
- Pour the last blocks: metrics, confusion matrix, importance, the Démarche (lignage), and the Journal.
- Reference for a complete answer: 7 sections out of 7, about 14 500 useful characters, 15 blocks, and an automatic journal of 87 entries.
- Lecture, then Imprimer / PDF: the subject asks for a 3 to 6 page PDF organised by task number.
- Vérifier one last time: 14 / 14, mission complete.
Debrief, together. The instructor puts the progress page on screen: one row per student, one column per step, hints consumed, last activity. Then discuss, with the numbers in front of you:
| Question | What the trial found |
|---|---|
| Can this exam be taken in rakoon-ds without Orange? | Yes. Nine tasks out of ten are click-only; one task requires Python because the subject demands it |
| What is better than Orange here? | The report is inside the tool; the lineage and journal are automatic; leaks are flagged without being asked; the baseline is an algorithm, not a discipline; re-running nine transformations after re-plugging the head of the chain takes 0.05 s |
| What is worse? | Two forest hyperparameters missing; no cumulative distribution; no date difference in days; the graph becomes unreadable past fifty nodes and an exam makes seventy; a deep forest weighs 500 MB |
| What does the tool give away? | The weekday is a checkbox, the Coach already diagnoses imbalance and overfitting, and the Quality tab answers three tasks. The marking scheme has to move from 'could you build it' to 'which one did you use, and why' |
Last exercise, and it is the one that matters: write three lines on what you would have got wrong if the tool had not warned you. Then three lines on what the tool let you get wrong anyway. The second list is the one you will need in your first job.
What you should have
- One Python node, four lines, whose output you can defend
- A permutation importance chart turned into a jargon-free explanation
- Two models compared at 0.701 and 0.684 accuracy, AUC 0.764 and 0.740
- A quality report with 2 924 duplicates and the unmatched station named
- Ethics and limits answering six specific questions
- A temporal split on a sealed 2022 test set
- The mission at 14 / 14 and a report of seven sections
Deliverables
- Mission:
epita-2026f-objets-trouvescomplete, 14 / 14 - Report: seven sections, at least fifteen blocks, exported as PDF and as Markdown + images (.zip)
- The two three-line lists of the debrief
Bonus
- Run the
epita-2025sorepita-2023smission (air passengers) as a second case study: thirteen and twelve steps, entirely click-only, best R² 0.884 with a random split and 0.715 with a temporal one. - Take the same subject in Orange and time yourself. The trial run measured under three minutes of server compute for an exam scheduled over four hours; the interesting number is not the compute, it is how many of the four hours were spent on wiring.
- Read your own automatic journal from top to bottom. Every mistake you made is in it, with a timestamp. That is what reproducibility feels like from the inside.
Resources
- Session 15 slides (the lecture this practical work follows)
- Course page: both programmes, all fifteen sessions
- rakoon-ds studio
missions/dep-15.json: which steps of the embedded mission belong to this session, and the two extra checkpoints- The other seven embedded exam missions:
epita-2021s1,epita-2023f,epita-2023s,epita-2024f,epita-2024s,epita-2025f,epita-2025s