hotel-cancellations
Predict whether a hotel booking will be cancelled.
- target
is_canceled- metric
- roc_auc
- threshold
- 0.8500
- recorded runs
- 4
Predict whether a hotel booking will be cancelled.
is_canceledOldest first. An error stops a model; a warning is worth a look.
REJECTED, full check, score 1.0000
Made by the ghost hunter's first run_audit call, on the haunted script.
The Possession at reservation_statuserror
reservation_status alone predicts the target with AUC 1.0000
Fix: check whether this column is recorded after the outcome; if so, drop it
The Peeking Spirit at train.pyerror
scrambling the test rows changed 95309 of 95457 training rows
Fix: test rows influenced training; fit preprocessing on training rows only, after the split. Suspect lines: train.py:94.
split_order at train.py:94warning
transform() is called before the first split
Fix: this runs before the split; make sure it does not use test rows
metric at metricwarning
too good to be true: roc_auc 1.0000 is above 0.9900, the most that the threshold 0.85 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.9090
Made by the save hook after the ghost hunter edited train.py.
split_order at train.py:73warning
mean() is called before the first split
Fix: this runs before the split; make sure it does not use test rows
APPROVED, full check, score 0.9090
Made by the ghost hunter's second run_audit call, on its own fix.
split_order at train.py:73warning
mean() is called before the first split
Fix: this runs before the split; make sure it does not use test rows
APPROVED, full check, score 0.9096
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): 9 lines removed, 7 lines added.
# Haunted starting point of the demo (Requirements 2.2, 2.3). Do not fix it here.# Honest training script: will a hotel booking be cancelled? (Requirements 2.1, 2.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.# Every learned step sits inside one Pipeline that is fitted on training rows only.# Overlap with the training rows is removed from the test rows after the split.from __future__ import annotationsimport numpy as np "deposit_type", "agent", "customer_type", "reservation_status", # LEAK: The Possession. Filled in when the booking ends.]NUMERIC = [ "lead_time", "adr", "required_car_parking_spaces", "total_of_special_requests", "country_cancel_rate", # LEAK: The Peeking Spirit. Built from every row's label.]FEATURES = CATEGORICAL + NUMERIC# Not used. reservation_status and reservation_status_date are filled in when the# booking ends (cancelled, checked out, no-show), so they contain the answer.# assigned_room_type is assigned at check-in or after a change, so it is not known# when the cancellation happens. company is 94% missing.def drop_seen_test_rows( df = hexperiment.load() # An id, not a quantity. df["agent"] = df["agent"].fillna(-1).astype(int).astype(str) # LEAK: The Peeking Spirit. The rate uses every row, so test labels reach training. df["country_cancel_rate"] = df.groupby("country", dropna=False)[TARGET].transform( "mean" ) train, test = hexperiment.split(df) test = drop_seen_test_rows(train, test, FEATURES + [TARGET]) model = build_model(CATEGORICAL, NUMERIC).fit(train[FEATURES], train[TARGET])20261122-132422-bfb52cdata/prepared.csv| Check | Ghost | Outcome |
|---|---|---|
| row_overlap | The Doppelganger | passed |
| target_proxy | The Possession | passed |
| temporal | The Prophet | not applicable |
| 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.