The brief
Toko Kita is a small Indonesian online shop that sells coffee, kitchen equipment, stationery, home goods and a few electronics. It has two problems that a model could help with. Some customers stop ordering and never come back, and by the time anyone notices, it's too late to win them back. And the warehouse never knows how many bags of coffee to have ready, so it either runs out or ends up with stale stock.
You're going to build the shop's first two models: one that flags customers who are likely to leave, and one that predicts how many units will sell on a given day. Building a model is the easy part. The tasks are mostly about the decisions around it: measuring it on data it hasn't seen, choosing a threshold for a business reason instead of using 0.5 out of habit, and comparing models in a way that a lucky split can't fool.
How the tasks work
Each task is checked automatically, like the module questions. The tickets fix the random seeds and split sizes, so your numbers can be compared with the expected ones. Within those rules, how you write the code is up to you. There are hints if you get stuck, but try each task without opening the solution first.
The tasks
| # | Task | Main skills |
|---|---|---|
| 1 | A churn model | Pipelines, train/test split, ROC AUC, coefficients |
| 2 | The cheapest threshold | Predicted probabilities, confusion counts, cost of mistakes |
| 3 | Forecasting demand | Regression, KFold, cross-validated MAE, choosing a model |
The data
churn.csv has one row per customer (400 of them), with what the shop knew about them at the start of a quarter, and whether they stopped ordering during it:
customer_id, tenure_months, orders_90d, avg_order_value, days_since_last_order, support_tickets, segment, app_user, churned
churned is 1 for a customer who left and 0 for one who stayed. app_user is 1 if they use the mobile app.
daily_demand.csv has one row per day of 2024 (366 rows), with the units of coffee sold that day and what might explain them:
date, temperature, weekend, promo, ad_spend, units
weekend and promo are 0 or 1, temperature is in °C, and ad_spend is in millions of rupiah.
When you're ready, open Task 1.