flight-delays
Predict whether a 2013 New York flight arrives more than 15 minutes late, from its schedule.
- target
late- metric
- roc_auc
- threshold
- 0.6000
- recorded runs
- 4
Predict whether a 2013 New York flight arrives more than 15 minutes late, from its schedule.
lateOldest first. An error stops a model; a warning is worth a look.
REJECTED, full check, score 0.7971
Made by the ghost hunter's first run_audit call, on the haunted script.
The Prophet at time_hourerror
81830 test row(s) are earlier than the latest training row (2014-01-01T04:00:00+00:00)
Fix: split by time with hexperiment.split
split_order at train.py:71warning
transform() is called before the first split
Fix: this runs before the split; make sure it does not use test rows
canary at train.pywarning
the canary test was not applied: 49090 scrambled test rows ended up in the training set
Fix: split with hexperiment.split(df), not with your own split
metric at metricwarning
too good to be true: roc_auc 0.7971 is above 0.7500, the most that the threshold 0.6 and the margin allow
Fix: treat this as a leak until proven otherwise: look for a column that encodes the target
UNVERIFIED, fast check, score 0.6193
Made by the save hook after the ghost hunter edited train.py.
No findings.
APPROVED, full check, score 0.6193
Made by the ghost hunter's second run_audit call, on its own fix.
No findings.
APPROVED, full check, score 0.6193
Made by hand afterwards, on the honest reference script kept in the repository.
No findings.
haunted/train.py against train.py (the honest script kept in the repository): 17 lines removed, 11 lines added.
# Haunted starting point of the demo (Requirements 3.2, 3.3). Do not fix it here.# Honest training script: will a 2013 New York flight arrive more than 15 minutes late,# judged from its schedule alone? (Requirements 3.1, 3.4)## To run it, copy this file over ../train.py, then run hexperiment on the app.# It is the honest script plus the leaks marked "LEAK:" below.# hexperiment.split puts the latest 20% of flights in the test set. Every learned step# sits inside one Pipeline fitted on training rows only.from __future__ import annotationsimport numpy as npimport pandas as pdfrom sklearn.compose import ColumnTransformerfrom sklearn.ensemble import HistGradientBoostingClassifierfrom sklearn.model_selection import train_test_splitfrom sklearn.pipeline import Pipelinefrom sklearn.preprocessing import OrdinalEncoderTARGET = "late"CATEGORICAL = ["carrier", "origin", "dest"]NUMERIC = [ "month", "day", "sched_dep_time", "sched_arr_time", "distance", "carrier_day_late_rate", # LEAK: The Peeking Spirit. Built from every row's label.]# month and day stay on purpose: a scheduled flight repeats every day with the same# columns, so without a date identical rows would sit in both train and test.NUMERIC = ["month", "day", "sched_dep_time", "sched_arr_time", "distance"]FEATURES = CATEGORICAL + NUMERIC# Not used: flight and tailnum (identifiers), hour and minute (already inside# sched_dep_time). fetch_data.py removed dep_time, dep_delay, arr_time and air_time:# they exist only after departure.def drop_seen_test_rows(def main() -> None: df = hexperiment.load() # LEAK: same-day late rate of the carrier over all rows, test labels included. day = df["time_hour"].str[:10] df["carrier_day_late_rate"] = df.groupby(["carrier", day])[TARGET].transform("mean") # LEAK: a random split on time-ordered data puts later flights in training. train, test = train_test_split(df, random_state=0) # LEAK: random split train, test = hexperiment.split(df) # the latest 20% by time_hour is the test set test = drop_seen_test_rows(train, test, FEATURES + [TARGET]) model = build_model(CATEGORICAL, NUMERIC).fit(train[FEATURES], train[TARGET]) hexperiment.audit(20261122-131840-3eec70data/prepared.csvtime_hour| Check | Ghost | Outcome |
|---|---|---|
| row_overlap | The Doppelganger | passed |
| target_proxy | The Possession | passed |
| temporal | The Prophet | passed |
| split_order | - | passed |
| canary | The Peeking Spirit | passed |
| determinism | The Shapeshifter | passed |
No waivers applied.
The test set has been evaluated 4 time(s), including this run.
Raw files: verdict.json and model_card.md.