Inspiration
The GM wants to replace the 10 lowest-earning machines. Before spending up to $220k, we asked: is it luck, location, or a leak?
What it does
For every machine, we split its shortfall against an average machine into six dollar amounts that add up exactly: luck, downtime, game math (RTP), the machine itself, location, and partial period. For the manager's bottom 10, the $544k gap is 41% location, 24% late installs, 22% generous game math, 12% luck, and only 1% the machines themselves. Only M-1158 fails a luck test corrected for 310 comparisons (FDR q < 0.001), so we inspect it.
An optimizer picks the plan from every legal combination of up to three actions: inspect M-1158, two July promotion weekends, Back Forty signage: $38,700, keeping $61,300. It stays net-positive in every scenario.
How we built it
End to end on Databricks, deployed as one Asset Bundle with the Databricks CLI:
- Unity Catalog: one governed schema for 40+ documented tables, volumes and the model, with lineage.
- Lakeflow Declarative Pipeline (serverless): Auto Loader bronze (17 tables) → silver with 12 expectations → 14 gold decision tables.
- MLflow: baseline vs weekday vs weekday + pre-announced events; time holdout plus rolling backtest. The winner cuts error from $218k to $62k a day and is registered in Unity Catalog.
- Serverless notebooks: budget optimizer with 5-scenario sensitivity.
- AI/BI Dashboard: 7 pages; date parameters re-run the decomposition and FDR; a page reads the pipeline event log.
- Lakeflow Jobs: pipeline → forecast → optimizer → dashboard refresh, daily.
Challenges we ran into
- Databricks Free Edition limits: one active pipeline, serverless quotas, and no fully public dashboard sharing.
- Delta table features: source timestamps without time zones required enabling
timestampNtzon every table. - Our own data-quality rule fired: decimal rounding left the six parts $0.045 off the total, so we moved to full precision.
- Spark to pandas: DECIMAL columns arrived as Python Decimals and broke the optimizer math.
What we learned
Raw house win is the wrong ranking. Back Forty demand fell 32 points against other zones while its walkway was closed; the casino's own promotions added +18%; comp redemption got 56% cheaper on May 1. On Databricks: expectations make data rules enforceable and visible, bundles make the whole stack reproducible, and MLflow keeps model comparisons honest.
Synthetic data. Built with help from Claude (Anthropic); all numbers computed in Databricks.