Skip to content
Français

Frame the forecast

  • Lesson 2
  • 30 min
  • Module 1: Forecasts serve decisions

Where we are

We have seen that a forecast is only as good as the decision it feeds. But "forecast sales" is still not a problem we can solve: it has no level, no horizon and no cost. In this lesson, we write the forecast frame for Kenji's stock order and for Grace's roster.

What you will be able to do

Write down exactly what to forecast before you build anything: what you count, at what level, how far ahead, how often, and for whom. A forecast with no frame can be accurate and still useless to the person who must decide.

Before you startWhat to know and to have readyAbout 30 minutes

What you need to know

What you need on your computer

Nothing. This lesson has no code. You write two cards, on paper or in a text file.

A small café orders its milk from a dairy. The owner orders every Monday morning. The dairy delivers on Tuesday, and the next delivery comes one week later. Before she orders, she makes a guess about the coming week.

Without noticing it, she answers five questions every Monday:

  1. What does she count? The milk that customers would drink. Last Friday, she ran out at 15:00. The sales of that afternoon were zero, but customers still asked for coffee with milk. So she counts what customers wanted, not only what she sold.
  2. For what? For each kind of milk on its own: cow’s milk and oat milk. A guess for “all drinks” tells her nothing about oat milk.
  3. How far ahead? From Tuesday’s delivery until the next one: 7 days. A guess for tomorrow alone is too short, and a guess for next month is too far.
  4. How often? Every Monday, with the sales up to Sunday.
  5. For whom, and what does a miss cost? For herself. Milk that goes sour is thrown away. A customer who gets no milk may not come back.

These five answers turn “guess the milk” into a problem that she can solve. Larkfield needs the same answers, for many more products.

Tomás opens a notebook. “Easy,” he says. “We forecast Larkfield’s sales.” Two hours later, he has a good forecast: the total units that Larkfield sells each day. The total is smooth, and his forecast follows it closely.

He shows it to Kenji. Kenji asks: “How many parasols do I send to the coast warehouse on Monday?” The forecast cannot answer. It has no products, no regions, and no idea of Kenji’s order. It is accurate, and it is useless for this decision.

Then Kenji adds a second problem. “Your history says that the coast sold zero parasols from 3 to 6 July. That was the heat wave. We had none to sell.” Tomás’s forecast learned from those zeros as if nobody wanted a parasol.

Tomás did nothing wrong in his code. He solved a problem that nobody had. The fix is to write the problem down first.

A forecast frame is a short written answer to the café owner’s questions, made before you touch any data or model. Like a picture frame, it decides what is inside and what is outside. It starts from the decision of the last lesson, and it ends with the cost of a miss. In between are five choices: what, level, horizon, how often and who.

Sales are the units that customers bought. Demand is the units that customers wanted to buy. Most days, the two are the same. They differ on a stock-out day, when the shelf is empty for part or all of the day. Then:

sales = the smaller of demand and the stock on the shelf

Here is the parasol on the coast in the heat wave. From 3 to 6 July 2025, customers wanted 2, 1, 4 and 7 parasols. Larkfield had none, so the sales were 0, 0, 0 and 0. That is 14 lost sales: the 14 of the last lesson.

  • Sales
  • Demand (we know it because we made the data)
Parasol sales and demand on the coast. On the four stock-out days, the sales are zero and the demand is not: 2 + 1 + 4 + 7 = 14 lost sales.
Text description of the chart

The chart shows 21 days of the parasol in the coast region, from 23 June to 13 July 2025. There are two lines with a dot for each day. On most days, the sales line and the dashed demand line are the same, between 0 and 9 parasols a day. From 3 to 6 July, the two lines split. The sales line lies on zero, while the demand line shows 2, 1, 4 and 7 parasols. On 7 July, new stock arrived, and the lines meet again at 5.

In real data, you cannot see demand on a stock-out day. You see only the sales and, if you are lucky, a mark that the shelf was empty. Larkfield’s data has that mark: a column stock_out.

So the frame says: forecast demand. Train on sales only where they equal demand. Mark the stock-out days, and do not treat their zeros as “nobody wanted it”. Module 2 shows how to fill those days. For the help desk, the question is easier. Every ticket is recorded, even when nobody answers it at once. So the tickets that arrive are the demand.

The level of a forecast is what one forecast number describes. It can be one product or a whole category, one region or the whole shop, one day or one week. Larkfield’s products form a hierarchy, a tree of levels. There are 200 products in 10 categories, sold in 3 regions (north, south and coast).

Each level gives a different picture. The table shows how often a level has no sales at all in a period.

Level of one forecast Series Rows with zero sales
One product in one region, per day 600 43.7%
One product in one region, per week 600 18.5%
One product, all regions, per day 200 26.5%
One category in one region, per day 30 2%
One category, all regions, per day 10 0.2%
All products, per day 1 0%

A series here is one line of numbers in time order, such as “parasol, coast, each day”. At the bottom of the tree, one product in one region on one day, 43.7% of the days have no sales. Such series are noisy and hard to forecast. Higher up, the zeros disappear. At the top, Tomás’s total never has a zero day, and it is the easiest series to forecast.

So why not forecast the total? Because the frame takes its level from the decision. Each region keeps its own stock, and Kenji orders for each product and each region. So his forecast must have one number for each product in each region: 600 series. A higher level can help, and Module 6 uses it. But the numbers that Kenji orders from must be at his level, and they must add up to the totals.

The horizon is how far into the future the forecast must reach. The rule: the horizon is the time from the decision until your next chance to correct it. For the café, the milk of Tuesday must last until the next Tuesday: a horizon of 7 days.

Kenji orders every Monday. In this course, an order must cover 14 days. That is one week until the next order, and one more week until the goods of that order arrive. This is an assumption of the course. Grace makes the roster for one week, hour by hour: a horizon of 168 hours.

Decision Made Covers Horizon
The café’s milk Monday Tuesday to the next Monday 7 days
Kenji’s weekly order Monday The next 14 days 14 days
Grace’s roster Monday Each hour of the week 168 hours
Kenji’s season order of parasols Before April April to September About 6 months

The last row is the order of the last lesson. Kenji ordered 2,000 parasols for six months, and he had no chance to correct it. Nobody can forecast the weather of July in March. A shorter horizon makes the forecast easier and the decision safer. Sometimes the best fix for a forecast is to change the decision, so that it needs a shorter horizon.

The frame also says when the forecast runs, and with which data. Kenji’s and Grace’s forecasts run every Monday, with the data up to Sunday. The last day of data that a forecast may use is its cut-off. Nothing after the cut-off may enter the forecast, because in real life it does not exist yet.

Run the forecast as often as the decision is made, not more. A new forecast every hour does not help Kenji, who orders once a week.

Last, the frame names the person who acts on the forecast, and the prices of a miss in each direction. For Kenji, a left-over unit costs 25% of its price and a lost sale 35%. For Grace, an extra agent hour costs 28 dollars and an hour one agent short 72 dollars. These are the assumptions of the course, and the frame writes them down so that everybody uses the same prices.

The person also tells you how the forecast will be checked. Kenji wants to know each Monday whether last week’s forecast was too low or too high. That check is part of the frame too.

Priya writes the frame of Kenji’s stock order on one card. The whole team can read it in a minute, and it hangs next to the code.

A card titled Forecast frame: Kenji's stock order, with eight numbered rows. 1 Decision: how many units of each product to order for each region; Kenji orders every Monday. 2 What: demand, the units that customers want; not sales, because on a stock-out day sales are lower than demand. 3 Level: one product in one region, per day: 600 series, 200 products and 3 regions. 4 Horizon: 14 days: the order must last one week until the next order, and one more week until that order arrives. 5 How often: every Monday, with the sales up to Sunday. 6 User: Kenji, the stock planner; he can change an order, and he writes down why. 7 Cost of a miss: too high, a left-over unit costs 25% of the price; too low, a lost sale costs 35% of the price. 8 Check: each Monday, compare last week's forecast with the sales; look for a forecast that is too low or too high week after week. A note at the bottom: the costs are assumptions of the course.
The forecast frame of Kenji's stock order, as a one-page card. Each row answers one question, and every later choice in the course must fit it.
Text description of the diagram

The card has a blue title, “Forecast frame: Kenji’s stock order”, and eight numbered rows. 1, decision: units of each product to order for each region, every Monday. 2, what: demand, not sales. 3, level: one product in one region, per day, 600 series. 4, horizon: 14 days. 5, how often: every Monday, with the sales up to Sunday. 6, user: Kenji, who writes down why he changes an order. 7, cost of a miss: 25% of the price for a left-over unit, 35% for a lost sale. 8, check: each Monday, look for a forecast that misses in the same direction week after week. A note says that the costs are assumptions.

Each row limits the next: the decision sets the level and the horizon. The cost of a miss will set how much Kenji orders above the forecast. When Tomás later proposes a new model, the card gives the test. Does it forecast demand for 600 series, 14 days ahead, every Monday, at a lower cost?

Now write the frame of Grace’s roster. Use the card’s eight rows. Take the facts from this lesson and the last one.

  1. Write the decision: what Grace sets, and for which hours.
  2. Write what you count. Say why it is the demand.
  3. Write the level: which channels, and which unit of time.
  4. Write the horizon.
  5. Write how often the forecast runs, and its cut-off.
  6. Write the user.
  7. Write the cost of a miss in each direction, and the number of tickets that one agent answers in an hour.
  8. Write one check that Grace can run each Monday.
Show Priya’s card
Row Grace’s roster
1 Decision How many agents to put on the roster in each hour of the week, from Monday 00:00 to Sunday 23:00
2 What The tickets that customers create, in all channels (email, chat, phone). Every ticket is recorded, even when it waits, so the tickets are the demand.
3 Level All channels together, per hour. The roster needs only the open hours, 07:00 to 21:59.
4 Horizon 168 hours: one week
5 How often Every Monday, with the tickets up to Sunday 23:00
6 User Grace, the support lead
7 Cost of a miss Too high: an extra agent hour costs 28 dollars. Too low: an hour one agent short costs 72 dollars. One agent answers about 6 tickets an hour. These are assumptions of the course.
8 Check Each Monday, compare last week’s tickets with the roster, hour by hour. Count the hours that were short, as for the heat-wave week.

Your words can differ. Check the numbers: one hour as the unit, 168 hours ahead, 6 tickets an agent hour, 28 and 72 dollars.

Kenji’s season order of 2,000 parasols also had a frame, but nobody wrote it down. Write its rows 1 to 5 now. Then predict: which row made the summer of 2025 go wrong? Then change one row so that the next summer is safer, and say what that change costs.

Show the answer
  1. Decision: how many parasols to buy for the whole season, once, before April.
  2. What: the demand of the season. Kenji used the sales of 2024, which were also the demand that year (2,200).
  3. Level: one product, all regions together, for the whole season.
  4. Horizon: about 6 months, from April to the end of September.
  5. How often: once a year.

The horizon made the summer go wrong. A 6-month forecast could not know that June to August would be cold, and Kenji had no chance to correct the order. The level was a second problem: one total for all regions said nothing about the coast in a hot week.

A safer frame orders in smaller steps. For example, Kenji places a first order for April and May, and then an order every Monday for the next 14 days. Each order then needs only a 14-day forecast. This change has costs. Small orders can cost more per unit, the supplier must deliver fast, and Kenji must order every week. Those costs belong on the card too.

Write a frame for every forecast that feeds a decision, before you open the data. It takes about an hour with the people who use the forecast. It saves days of work on the wrong problem. It also stops a common argument later: when the forecast misses, the card says what “good” meant.

A frame also changes. A faster supplier shortens the horizon; a new region changes the level. Update the card, and run the tests again. An old card that nobody updates is worse than none, because people trust it.

Common mistake

A forecast of sales learns the empty shelf

Symptom: product P002, the black folding chair, had no stock in the north from 12 to 20 May 2025: nine days of zero sales. A standard method trained on those sales forecasts 7 chairs for the next 14 days. The real demand is 52, so Kenji’s order would be far too small.

Cause: the frame said “sales”, or nobody wrote a frame. The empty shelf looks exactly like customers who do not want the product.

Fix: frame the forecast as demand, and mark the stock-out days. Clean without hiding demand shows this stock-out on a chart and fills the days.

Consequence in AI work: the low forecast lowers the next order, which causes the next stock-out. Teams have stopped selling good products this way.

Check your understanding

Name the parts of a forecast frame, and say for each one what it answers for Kenji's stock order.

Show the answer
  • Decision: how many units of each product to order for each region, every Monday.
  • What: demand, not sales, because sales are lower than demand on a stock-out day.
  • Level: one product in one region, per day: 600 series.
  • Horizon: 14 days, the time until the next order arrives.
  • How often: every Monday, with the data up to Sunday (the cut-off).
  • User: Kenji, who can change an order and writes down why.
  • Cost of a miss: a left-over unit costs 25% of the price, and a lost sale 35% (assumptions).
  • Check: each Monday, compare last week’s forecast with the sales.

Check your understanding

Predict and explain: Tomás's forecast of Larkfield's total daily sales is very accurate. Why can Kenji still not use it for his order? What should Tomás have done first?

Show the answer

The total has the wrong level. Kenji orders for each product in each region, so he needs 600 numbers, not one. The total is accurate partly because it is easy. It never has a zero day, while 43.7% of the days of one product in one region have no sales. The total also counts sales, so it learned the zeros of stock-out days as low demand. Tomás should have written the forecast frame with Kenji first: demand, product and region, 14 days, every Monday, with the costs of a miss.

Check your understanding

Kenji's supplier will deliver within 3 days from next year. Kenji still orders every Monday. Which row of his card changes, and why is that good news for the forecast?

Show the answer

The horizon changes. The order must now last one week until the next order and 3 days until that order arrives: about 10 days instead of 14. A forecast for 10 days is easier than one for 14, because the far days are the hardest to forecast. So the same method misses less, and Kenji can keep less stock. The rest of the card stays the same. The tests of the course must be run again with the new horizon.

Recap

  • A forecast frame answers the questions of the decision before any data or model. What, at what level, how far ahead, how often, for whom, and what does a miss cost?
  • What: forecast demand, not sales. On a stock-out day, sales are lower than demand. The coast lost 14 parasol sales that the sales data shows as zeros.
  • Level: take it from the decision. Kenji needs one product in one region per day, 600 series, even though 43.7% of those days have no sales.
  • Horizon: the time from the decision until the next chance to correct it. Kenji’s weekly order: 14 days. Grace’s roster: 168 hours. A 6-month season order cannot be corrected, and that hurt Larkfield in 2025.
  • How often: as often as the decision, every Monday, with the data up to the cut-off.
  • Write the frame as a one-page card, and keep it true when the decision changes.

You can now say exactly what Larkfield must forecast. But we have not opened the data yet. Next, you run the setup notebook, read Larkfield’s tables, and meet the backtest table that every module fills.

Next: Meet the Larkfield data