A seasonal forecast is useful only if it beats a simple reference on data it did not see. Here, a custom NumPy least-squares trend-plus-seasonality model is replayed against public Wikipedia pageviews and compared with a seasonal-naive forecast.
- Data: daily views of the English Wikipedia “Peyton Manning” page, not employer data.
- Evaluation: 363 observed holdout days inside a 365-calendar-day test window.
- Use: the model improves on this baseline for this series; its fitted residual interval is exploratory, not a calibrated commitment bound.
This example uses public daily pageviews from the Prophet repository's example dataset. It contains no employer systems or data.
At Chegg, I built seasonality-aware traffic and ad-inventory forecasts for direct-sales commitments and revenue planning. This smaller public-data example shows the evaluation logic without implying that one series or model transfers directly to another business. The source CSV is part of Prophet's example collection; the model here is a custom NumPy least-squares implementation, not Prophet.
Define the forecast question
The series is daily pageviews for the English Wikipedia “Peyton Manning” article in Prophet's example collection, from December 10, 2007 through January 20, 2016. The CSV stores log views; the analysis converts them back to views. It contains weekly patterns, yearly seasonality related to the NFL calendar, and event-driven variation. For definitions of forecast errors, holdout evaluation, and seasonal-naive methods, see Forecasting: Principles and Practice.
The forecast question is: using data available before the holdout, how well can the model predict daily views over the next year, and does it improve on repeating the same weekday from 52 weeks earlier?
Build a baseline and model
Forecast evaluation workflow
- Pin the source and cutoff
Record the data version and forecast origin available at the time.
- Fit training data only
Estimate trend and seasonal structure before the holdout begins.
- Replay a simple baseline
Forecast the same dates with seasonal naive for a useful reference.
- Score observed days
Compare actuals and forecasts with more than one error summary.
- Decide with limits
Use rolling evaluations and calibrated uncertainty before commitments.
- Training window: 3 years (1,092 days), ending immediately before January 21, 2015.
- Model: least squares on log views, with a linear trend, weekday effects, and 6 pairs of yearly Fourier terms.
- Baseline: seasonal naive, using the same weekday 52 weeks earlier.
- Holdout: the 365-calendar-day period from January 21, 2015 through January 20, 2016. The source has 363 observed days for the model in that window.
- Interval: ±1.96 training-residual standard deviations on the log scale, converted back to views. This simple fitted-residual band is not calibrated for operational safety.
The model is fitted before the holdout. The seasonal-naive baseline is a rolling comparison, however: its 364-day lag means the last target day uses the first holdout day as its reference. It scores 362 paired observed days, while the seasonal model scores 363. The headline metrics therefore have almost—but not exactly—the same evaluation dates, and the baseline is not a fully fixed-origin year-ahead forecast.
Compare errors on the holdout
| Week of | Actual | Forecast | Interval |
|---|---|---|---|
| 2014-01-26 | 25,458 | — | — |
| 2014-02-02 | 85,766 | — | — |
| 2014-02-09 | 3,778 | — | — |
| 2014-02-16 | 2,444 | — | — |
| 2014-02-23 | 2,250 | — | — |
| 2014-03-02 | 2,192 | — | — |
| 2014-03-09 | 2,238 | — | — |
| 2014-03-16 | 1,885 | — | — |
| 2014-03-23 | 2,625 | — | — |
| 2014-03-30 | 1,717 | — | — |
| 2014-04-06 | 1,677 | — | — |
| 2014-04-13 | 1,634 | — | — |
| 2014-04-20 | 2,277 | — | — |
| 2014-04-27 | 1,964 | — | — |
| 2014-05-04 | 3,597 | — | — |
| 2014-05-11 | 2,204 | — | — |
| 2014-05-18 | 2,022 | — | — |
| 2014-05-25 | 2,256 | — | — |
| 2014-06-01 | 1,621 | — | — |
| 2014-06-08 | 1,598 | — | — |
| 2014-06-15 | 1,407 | — | — |
| 2014-06-22 | 1,290 | — | — |
| 2014-06-29 | 1,425 | — | — |
| 2014-07-06 | 1,505 | — | — |
| 2014-07-13 | 1,899 | — | — |
| 2014-07-20 | 2,047 | — | — |
| 2014-07-27 | 2,571 | — | — |
| 2014-08-03 | 2,567 | — | — |
| 2014-08-10 | 3,464 | — | — |
| 2014-08-17 | 3,127 | — | — |
| 2014-08-24 | 3,791 | — | — |
| 2014-08-31 | 4,389 | — | — |
| 2014-09-07 | 14,423 | — | — |
| 2014-09-14 | 10,307 | — | — |
| 2014-09-21 | 6,673 | — | — |
| 2014-09-28 | 4,395 | — | — |
| 2014-10-05 | 8,154 | — | — |
| 2014-10-12 | 6,165 | — | — |
| 2014-10-19 | 19,563 | — | — |
| 2014-10-26 | 6,150 | — | — |
| 2014-11-02 | 6,216 | — | — |
| 2014-11-09 | 4,126 | — | — |
| 2014-11-16 | 3,627 | — | — |
| 2014-11-23 | 3,905 | — | — |
| 2014-11-30 | 4,400 | — | — |
| 2014-12-07 | 3,816 | — | — |
| 2014-12-14 | 3,948 | — | — |
| 2014-12-21 | 4,001 | — | — |
| 2014-12-28 | 4,104 | — | — |
| 2015-01-04 | 5,558 | — | — |
| 2015-01-11 | 15,416 | — | — |
| 2015-01-18 | 7,219 | 8,474 | 2,769 to 25,933 |
| 2015-01-25 | 4,062 | 8,583 | 2,805 to 26,269 |
| 2015-02-01 | 10,130 | 6,242 | 2,039 to 19,102 |
| 2015-02-08 | 3,003 | 4,237 | 1,385 to 12,967 |
| 2015-02-15 | 2,593 | 2,978 | 973 to 9,114 |
| 2015-02-22 | 1,716 | 2,344 | 766 to 7,172 |
| 2015-03-01 | 2,272 | 2,113 | 690 to 6,467 |
| 2015-03-08 | 1,843 | 2,106 | 688 to 6,445 |
| 2015-03-15 | 1,439 | 2,164 | 707 to 6,623 |
| 2015-03-22 | 1,664 | 2,146 | 701 to 6,566 |
| 2015-03-29 | 1,456 | 1,986 | 649 to 6,077 |
| 2015-04-05 | 1,169 | 1,736 | 567 to 5,312 |
| 2015-04-12 | 1,322 | 1,500 | 490 to 4,590 |
| 2015-04-19 | 1,691 | 1,349 | 441 to 4,129 |
| 2015-04-26 | 1,650 | 1,301 | 425 to 3,982 |
| 2015-05-03 | 1,481 | 1,332 | 435 to 4,077 |
| 2015-05-10 | 1,463 | 1,387 | 453 to 4,245 |
| 2015-05-17 | 2,397 | 1,395 | 456 to 4,269 |
| 2015-05-24 | 1,300 | 1,311 | 428 to 4,013 |
| 2015-05-31 | 1,115 | 1,157 | 378 to 3,539 |
| 2015-06-07 | 979 | 997 | 326 to 3,051 |
| 2015-06-14 | 909 | 890 | 291 to 2,725 |
| 2015-06-21 | 1,391 | 864 | 282 to 2,645 |
| 2015-06-28 | 883 | 924 | 302 to 2,829 |
| 2015-07-05 | 1,017 | 1,060 | 347 to 3,245 |
| 2015-07-12 | 1,558 | 1,241 | 405 to 3,797 |
| 2015-07-19 | 1,481 | 1,412 | 461 to 4,320 |
| 2015-07-26 | 1,316 | 1,531 | 500 to 4,687 |
| 2015-08-02 | 1,485 | 1,611 | 527 to 4,931 |
| 2015-08-09 | 1,640 | 1,719 | 562 to 5,261 |
| 2015-08-16 | 1,941 | 1,948 | 637 to 5,963 |
| 2015-08-23 | 2,128 | 2,394 | 782 to 7,325 |
| 2015-08-30 | 2,493 | 3,119 | 1,019 to 9,544 |
| 2015-09-06 | 3,184 | 4,068 | 1,329 to 12,450 |
| 2015-09-13 | 6,761 | 4,963 | 1,622 to 15,189 |
| 2015-09-20 | 3,941 | 5,396 | 1,763 to 16,515 |
| 2015-09-27 | 4,919 | 5,190 | 1,696 to 15,882 |
| 2015-10-04 | 3,257 | 4,577 | 1,495 to 14,006 |
| 2015-10-11 | 2,727 | 3,942 | 1,288 to 12,063 |
| 2015-10-18 | 3,614 | 3,523 | 1,151 to 10,783 |
| 2015-10-25 | 3,087 | 3,368 | 1,101 to 10,309 |
| 2015-11-01 | 4,630 | 3,403 | 1,112 to 10,416 |
| 2015-11-08 | 3,829 | 3,483 | 1,138 to 10,659 |
| 2015-11-15 | 5,414 | 3,452 | 1,128 to 10,564 |
| 2015-11-22 | 3,591 | 3,251 | 1,062 to 9,949 |
| 2015-11-29 | 43,899 | 2,974 | 972 to 9,103 |
| 2015-12-06 | 3,029 | 2,795 | 913 to 8,555 |
| 2015-12-13 | 2,533 | 2,874 | 939 to 8,794 |
| 2015-12-20 | 2,418 | 3,344 | 1,093 to 10,232 |
| 2015-12-27 | 5,694 | 4,328 | 1,414 to 13,247 |
| 2016-01-03 | 4,944 | 5,800 | 1,895 to 17,749 |
| 2016-01-10 | 3,415 | 7,171 | 2,343 to 21,947 |
| 2016-01-17 | 14,467 | 8,558 | 2,796 to 26,190 |
Holdout error: model compared with seasonal naive
Lower is better. Percentages use each day's actual views as the denominator.
| Metric | Seasonal model | Seasonal naive |
|---|---|---|
| Mean absolute percentage error (MAPE) | 36.4% | 95.3% |
| Median absolute percentage error (MdAPE) | 24.9% | 49.4% |
| Daily error over observed holdout days | Seasonal model | Seasonal naive |
|---|---|---|
| Mean absolute percentage error (MAPE) | 36.4% (363 days) | 95.3% (362 days) |
| Median absolute percentage error (MdAPE) | 24.9% (363 days) | 49.4% (362 days) |
Both metrics divide each day's absolute error by that day's actual views, then summarize across days. MAPE averages those percentages; MdAPE reports their median. The model's error is lower on both summaries in this comparison. Because one baseline reference day falls inside the holdout and the scored days differ by one, read this as a simple rolling benchmark rather than a strict fixed-origin comparison. It is evidence about this split, not a guarantee of future accuracy.
The difference between mean and median errors says the daily percentage errors are unevenly distributed. A low-traffic actual value can produce a large percentage error for a modest absolute miss; unusual event days can also create large absolute misses. MAPE's denominator makes it especially important to inspect the series and the error distribution, rather than attributing the result to spikes alone.
The largest observed holdout day was November 30, 2015, with 189,032 views, compared with a holdout average of 3,605. A calendar model cannot know an unmodeled news event in advance. The fitted interval covered 98.4% of observed days here, but that one example does not establish calibrated coverage or a safe planning range. Also, exponentiating a fitted log value gives a typical/median-style prediction under this model, not an unbiased expected mean of views; a mean forecast would need an appropriate bias correction.
Translate a forecast into an operating decision
- Convert views into inventory explicitly. Apply documented ad-load, eligibility, and fill assumptions; keep those assumptions separate from the traffic forecast.
- Treat known events as inputs. Add relevant launches, holidays, sports calendars, or school terms only when they are known at the forecast date and supported by the business context.
- Score the model on rolling holdouts. Track error by horizon, season, and traffic level; compare with simple baselines after each refresh.
- Choose a commitment bound from calibrated evidence. Backtest lower quantiles or another uncertainty method against the cost of over- and under-forecasting. This example's residual band is not ready to set a guarantee.
What I would test next
I would add event regressors where the event schedule is known, compare damped trends with the linear trend, and evaluate interval coverage over multiple rolling windows. The next model should earn operational use through repeatable out-of-sample performance, not just a better fit on training data.
For another measurement walkthrough, see how I design and interpret an A/B test, or try the ad-auction floor-price simulator.
Calculation notes: the Python analysis reads the pinned public dataset linked above and writes the chart data consumed by this site. Forecast values, evaluation counts, and error metrics in this article are populated from that same output. The dataset comes from Prophet's examples; the model is the custom least-squares specification described here.