Day 2 · Tuesday · Empirical studio
Predicting a quoted London price
Pinned snapshot; prediction exercise, not pricing advice
| Item | Course definition |
|---|---|
| Files | london_price_development.csv;
london_price_validation.csv;
london_price_deployment_features.csv;
day2_application.ipynb |
| Unit | one eligible London listing with a valid one- to seven-night quote |
| Population and period | 54,636 eligible listings from 27,278 hosts in the Inside Airbnb London snapshot of 19 June 2026 |
| Target | price_gbp, the quoted nightly price in pounds; not a
transaction price, booking, occupancy, revenue, future price, or optimal price |
| Variables | numeric: accommodates, bedrooms, beds,
minimum_nights; categorical: room_type,
neighbourhood_cleansed; host_id is split-only |
| Prediction point | same-snapshot cross-sectional prediction before the target is supplied to the fitted model; this is not a future-time forecast |
| Splits | development: 32,749 listings/16,381 hosts; validation: 11,063/5,461; final holdout: 10,824/5,436; no host crosses splits |
| Source | Inside Airbnb, London detailed listings.csv.gz, 19 June 2026 |
| Where used | development fits preprocessing and models; validation compares predeclared candidates; the final holdout evaluates the recorded specification once |
Gate 1: answer before code
- The claim matched by the split
What does the final host-disjoint holdout examine most directly?
Prediction for another listing from a host used in fitting
Prediction for eligible listings from unseen hosts in the same snapshot
Prediction in next year's London market
The causal effect of increasing a listing's price
- What the target does not measure
Which question cannot be answered by
price_gbpalone?What quoted nightly price appears in the pinned listing snapshot?
How close is a model prediction to that quoted price?
How does quoted price vary with represented listing characteristics?
What price would maximise the host's profit if the host changed it?
- Preprocessing belongs inside the fitting boundary
Where should missing-value replacements and category definitions be learned when validation is used to compare models?
Development rows only
Development and validation combined before comparison
Validation rows only
The final holdout, because it is largest
What you will do in the notebook
Confirm row counts, target meaning, variables, and zero host overlap.
Calculate the development mean and median. Use the mean baseline for RMSE and the median baseline for MAE.
Fit a simple linear model using
accommodates; interpret its slope as a predictive association in this snapshot.Fit the compact linear model. Learn every imputer and category level from development rows only.
Compare the four predeclared candidates on all validation listings. Inspect impossible negative predictions without adding a new rule.
Record one specification. Only then open the final aggregate results.
| Model | MAE | RMSE | Predictive \(R^2\) | Negative predictions |
|---|---|---|---|---|
| Mean baseline | 128.999 | 170.726 | 0.000 | 0 |
| Median baseline | 120.744 | 174.946 | -0.050 | 0 |
| Simple linear model | 96.015 | 137.266 | 0.354 | 0 |
| Compact linear model | 75.483 | 114.628 | 0.549 | 7 |
- Selecting under squared-error concern
If the predeclared primary metric is RMSE, which model has the strongest validation result?
Mean baseline
Median baseline
Simple linear model
Compact linear model
- What the negative predictions reveal
How should the seven negative quoted-price predictions affect the conclusion?
Ignore them because average RMSE improved
Treat them as an impossible-output failure that must be addressed and evaluated on fresh evidence before deployment
Clip them to zero after seeing validation and claim the same validation as final evidence
Conclude that every compact-model prediction is wrong
- Reading the simple slope
The simple fitted slope is about £46.97 per accommodated guest. Which interpretation is appropriate?
Increasing any listing's capacity by one causes its price to rise by £46.97
In this fitted snapshot model, listings differing by one recorded guest have fitted prices differing by about £46.97
Every observed listing charges exactly £46.97 per guest
The slope estimates additional host profit
| Model | MAE | RMSE | Predictive \(R^2\) |
|---|---|---|---|
| Refitted mean baseline | 127.392 | 172.483 | 0.000 |
| Simple linear model | 96.921 | 138.933 | 0.351 |
| Compact linear model | 77.882 | 117.029 | 0.540 |
The compact model produces 15 negative predictions.
- The narrow empirical result
Which statement is supported?
The compact model reduces RMSE relative to the refitted mean for unseen hosts in this snapshot, while impossible outputs remain
The compact model predicts next year's market with RMSE £117.029
The compact model identifies the profit-maximising price
The compact model proves that its variables cause quoted prices
- Evidence needed for pricing advice
What would be required before recommending a price change to a host?
Only a lower same-snapshot RMSE
Transaction, occupancy, demand, revenue, and cost outcomes plus a credible design for the effect of changing price
The largest coefficient in the compact model
Replacing every negative prediction with zero