hotel-cancellations

Predict whether a hotel booking will be cancelled.

1.0000first run, REJECTED
0.9096last run, APPROVED
target
is_canceled
metric
roc_auc
threshold
0.8500
recorded runs
4

Every recorded run

Oldest first. An error stops a model; a warning is worth a look.

  1. REJECTED, full check, score 1.0000

    , test set used 1 time

    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

  2. UNVERIFIED, fast check, score 0.9090

    , test set used 2 times

    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

  3. APPROVED, full check, score 0.9090

    , test set used 3 times

    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

  4. APPROVED, full check, score 0.9096

    , test set used 4 times

    Made by hand afterwards, on the honest reference script kept in the repository.

    No findings.

The fix

haunted/train.py against train.py (the honest script kept in the repository): 9 lines removed, 7 lines added.

1-# Haunted starting point of the demo (Requirements 2.2, 2.3). Do not fix it here.
1+# Honest training script: will a hotel booking be cancelled? (Requirements 2.1, 2.4)
22 #
3-# To run it, copy this file over ../train.py, then run hexperiment on the app.
4-# It is the honest script plus the leaks marked "LEAK:" below.
3+# Every learned step sits inside one Pipeline that is fitted on training rows only.
4+# Overlap with the training rows is removed from the test rows after the split.
55 from __future__ import annotations
66
77 import numpy as np
17 unchanged lines
2525 "deposit_type",
2626 "agent",
2727 "customer_type",
28- "reservation_status", # LEAK: The Possession. Filled in when the booking ends.
2928 ]
3029 NUMERIC = [
3130 "lead_time",
13 unchanged lines
4544 "adr",
4645 "required_car_parking_spaces",
4746 "total_of_special_requests",
48- "country_cancel_rate", # LEAK: The Peeking Spirit. Built from every row's label.
4947 ]
5048 FEATURES = CATEGORICAL + NUMERIC
49+# Not used. reservation_status and reservation_status_date are filled in when the
50+# booking ends (cancelled, checked out, no-show), so they contain the answer.
51+# assigned_room_type is assigned at check-in or after a change, so it is not known
52+# when the cancellation happens. company is 94% missing.
5153
5254
5355 def drop_seen_test_rows(
42 unchanged lines
9698 df = hexperiment.load()
9799 # An id, not a quantity.
98100 df["agent"] = df["agent"].fillna(-1).astype(int).astype(str)
99- # LEAK: The Peeking Spirit. The rate uses every row, so test labels reach training.
100- df["country_cancel_rate"] = df.groupby("country", dropna=False)[TARGET].transform(
101- "mean"
102- )
103101 train, test = hexperiment.split(df)
104102 test = drop_seen_test_rows(train, test, FEATURES + [TARGET])
105103 model = build_model(CATEGORICAL, NUMERIC).fit(train[FEATURES], train[TARGET])
12 unchanged lines

Model card of the last approved run

Status

Verdict
APPROVED
Mode
full
Run id
20261122-132422-bfb52c
Date
2026-11-22T13:24:59Z
hexperiment version
0.1.0

Metric

roc_auc
0.9096
Threshold
0.8500
Result
passed

Split

Data file
data/prepared.csv
Test fraction
0.2
Seed
0
Time column
none

Data

Training rows
95457 (positive rate 36.9%)
Test rows
16023 (positive rate 26.6%)

Checks

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

Waivers

No waivers applied.

Test-set uses

The test set has been evaluated 4 time(s), including this run.

Raw files: verdict.json and model_card.md.