Why a demo?

Anyone can write on their website that they build forecasts. I preferred to show it. The demo runs entirely in your browser: no server, no library, no real customer data. The data is made up, the model is real.

The made-up bakery

First the page generates a year of sales figures: 364 days, from September 2025 to August 2026. Each day contains influences you know from real life:

  • Day of the week: Saturday is the strongest day, Monday the weakest.
  • Weather: more people come when it is sunny, fewer when it rains.
  • Public holidays: the statutory holidays in Lower Saxony, when it gets busier.
  • Season and slight growth over the year.
  • Chance: no two days are alike.

How strong these influences are is fixed in the code – the hidden truth, so to speak. The model never gets to see it. It only sees the finished sales figures: between 203 and 551 rolls a day, 329 on average. Because the random generator has a fixed seed (Buxtehude’s postcode), every visitor sees the same bakery.

The model: effects that multiply

I use a log-linear regression. It sounds clunky, but the idea is simple: every influence changes sales by a certain percentage, and those percentages are combined. A Saturday adds, rain subtracts – a rainy Saturday gets both. That fits sales figures well: rain costs more rolls on a busy Saturday than on a quiet Monday.

The model has 12 parameters: a base level, one for each of six weekdays (Monday is the baseline), two for the weather, one for holidays and two for the season. They are learned with least squares. In your browser that takes only milliseconds.

Testing honestly

A model that only looks good on the data it learned from is worthless. So it only learns from the first 44 weeks. The demo holds back the last 8 weeks and uses them to check how good the forecasts are for days the model has never seen.

The result: on average the forecast is off by 5.4 % (the experts call this MAPE). At 500 rolls, that is a good 25.

What the model found

The interesting part is the comparison with the hidden truth. The dots show what the model learned, the rings what is really in the data:

Learned effects compared with the hidden truth Saturday: model +68.5 %, truth +71.8 %; Sunday: model +29.1 %, truth +34.1 %; Friday: model +21.8 %, truth +24.7 %; Holiday: model +21.9 %, truth +24.0 %; Sun: model +7.2 %, truth +8.0 %; Rain: model -15.3 %, truth -14.0 %.
fig. 1 — learned effects (dot) and hidden truth (ring), compared with Monday, clouds or a normal day

The direction is right everywhere and the sizes are close. The model estimates the weekdays a little too low. One reason: the data contains slight growth over the year that the model does not know about. With more data and a trend it would be more accurate. That is exactly what data science looks like day to day: you look at where the model is off and ask why.

Why a band instead of a number

A forecast is never exact. That is why the demo shows an 80 % interval next to the number: in eight out of ten cases, actual sales fall within this range. This is where the part of my work in decision intelligence that excites me most begins: the forecast becomes a decision.

If the bakery bakes exactly the average, it will run short on roughly every other day. If it bakes the upper end of the band, it has enough in 9 out of 10 cases – but more is left over more often. Where to draw the line is not a maths question but a business one: what does an empty shelf cost, and what does a day-old roll cost?

What is harder in real life

  • Sold out does not mean “no demand”. If everything is gone by 11 am, nobody knows how much more would have sold. Such days need to be treated differently.
  • A lot is missing from the demo: school holidays, town festivals, roadworks outside the door, promotions.
  • Real data is messy: gaps, typos, a new till system in the middle of the year.
  • Sometimes a simple model like this is enough, sometimes you need more. You only know once you try it on your own data.

And for you?

If you have sales, booking or order data and want to know what is in it: tell me about it. With me, the first step is almost always a proof of concept – just like this demo.

Try the demo Write an enquiry