4. Data split
Train on the past, test on the future
The 36,416 usable orders are sorted by when they were placed, then cut at 70% and 85%. The model learns from the oldest orders and is tested on the newest, the same way the app will use it.
Why not a random split?
A random split mixes orders from the same days into training and testing. The model could then learn something about a busy evening from orders in that same evening and look better than it really is, because it has effectively seen the future. Splitting by time removes that shortcut: every test order was placed after every training order.
The cut points never split orders placed at the same minute, so the shares are as close to 70/15/15 as the timestamps allow.
| Partition | Orders | Share | First order | Last order |
|---|---|---|---|---|
| Training | 25,489 | 70% | 2022-02-11 08:10 | 2022-03-25 19:30 |
| Validation | 5,464 | 15% | 2022-03-25 19:35 | 2022-03-31 21:50 |
| Test | 5,463 | 15% | 2022-03-31 21:55 | 2022-04-07 00:00 |
Orders per day, by partition
Each column is one calendar day. Empty days are dates with no orders in the dataset.
- Training
- Validation
- Test
Training covers about six weeks. Validation and test each cover about one week at the end.
Show the numbers
| Date | Training | Validation | Test |
|---|---|---|---|
| 2022-02-11 | 700 | 0 | 0 |
| 2022-02-12 | 547 | 0 | 0 |
| 2022-02-13 | 682 | 0 | 0 |
| 2022-02-14 | 540 | 0 | 0 |
| 2022-02-15 | 674 | 0 | 0 |
| 2022-02-16 | 553 | 0 | 0 |
| 2022-02-17 | 689 | 0 | 0 |
| 2022-02-18 | 548 | 0 | 0 |
| 2022-02-19 | 10 | 0 | 0 |
| 2022-03-01 | 986 | 0 | 0 |
| 2022-03-02 | 756 | 0 | 0 |
| 2022-03-03 | 1,016 | 0 | 0 |
| 2022-03-04 | 741 | 0 | 0 |
| 2022-03-05 | 1,016 | 0 | 0 |
| 2022-03-06 | 751 | 0 | 0 |
| 2022-03-07 | 996 | 0 | 0 |
| 2022-03-08 | 738 | 0 | 0 |
| 2022-03-09 | 1,017 | 0 | 0 |
| 2022-03-10 | 755 | 0 | 0 |
| 2022-03-11 | 1,002 | 0 | 0 |
| 2022-03-12 | 744 | 0 | 0 |
| 2022-03-13 | 1,021 | 0 | 0 |
| 2022-03-14 | 724 | 0 | 0 |
| 2022-03-15 | 1,042 | 0 | 0 |
| 2022-03-16 | 742 | 0 | 0 |
| 2022-03-17 | 986 | 0 | 0 |
| 2022-03-18 | 746 | 0 | 0 |
| 2022-03-19 | 1,011 | 0 | 0 |
| 2022-03-20 | 741 | 0 | 0 |
| 2022-03-21 | 1,003 | 0 | 0 |
| 2022-03-22 | 12 | 0 | 0 |
| 2022-03-23 | 725 | 0 | 0 |
| 2022-03-24 | 1,011 | 0 | 0 |
| 2022-03-25 | 264 | 481 | 0 |
| 2022-03-26 | 0 | 1,026 | 0 |
| 2022-03-27 | 0 | 723 | 0 |
| 2022-03-28 | 0 | 995 | 0 |
| 2022-03-29 | 0 | 739 | 0 |
| 2022-03-30 | 0 | 998 | 0 |
| 2022-03-31 | 0 | 502 | 225 |
| 2022-04-01 | 0 | 0 | 1,003 |
| 2022-04-02 | 0 | 0 | 746 |
| 2022-04-03 | 0 | 0 | 1,032 |
| 2022-04-04 | 0 | 0 | 712 |
| 2022-04-05 | 0 | 0 | 1,015 |
| 2022-04-06 | 0 | 0 | 721 |
| 2022-04-07 | 0 | 0 | 9 |
What each partition is for
- Training
- 25,489
- The models learn from these orders. Every fitted step, including the median used to fill gaps and the one-hot categories, comes from here only.
- Validation
- 5,464
- Used to compare the models and choose each one's settings. The model with the lowest error here is the one the app selects.
- Test
- 5,463
- Checked once, at the end, after refitting on training and validation orders. These scores are the honest estimate of how the app will do.
Before the split, 7,884 orders without a road distance, 86 outside the app's distance limits and 1,198 without an order time were left out.