Skip to content
Mementropy
SolutionshungersyncNotebookExecuted example

HungerSync: a synthetic workload forecasting baseline

Compare weekly repetition and drift adjustment on 90 synthetic daily workload values, with a 14-day holdout measured in review cases/day.

By Ryan HammangUpdated

Role: Workload forecasting analyst (HungerSync operations)

Division: Operations planning

Goal: Compare weekly repetition with a drift-adjusted baseline for a 14-day forecast of synthetic review workload.

Boundary: Original generated daily values, not observed demand or live telemetry. No staffing changes, scheduling, or production actions are performed.

The saved execution reports Python 3.12.12. To explore the public download, use an isolated Python environment with JupyterLab, Matplotlib and IPython. The forecasting calculations use Python’s math, random and statistics standard-library modules. No external dataset, model weights, credentials, GPU or inference service is needed after installing the packages.

The public download omits the site-only styling cell, so it does not require mementropy.mplstyle; default Matplotlib styling is sufficient. Dependency versions are not locked in this download, and a clean-environment rerun has not been verified.

Evidence: these are saved outputs from an earlier execution, not rerun for the 2026-10-29 editorial update. Rendering displays saved cells; it does not execute them. The public download is not a locked environment or a production validation.

import math
import random
import statistics
import sys
import matplotlib.pyplot as plt
from IPython.display import display, Markdown, JSON
SEED = 42
HORIZON = 14
print({'python': sys.version.split()[0], 'seed': SEED, 'model': 'transparent drift-adjusted baseline'})
{'python': '3.12.12', 'seed': 42, 'model': 'transparent drift-adjusted baseline'}

There are 90 daily observations with zero-based day indices 0–89. The unit is review cases/day, represented as continuous synthetic workload rather than measured integer case counts. With seed 42, each value combines a level of 60, an upward trend of 0.2 per day, a seven-day sine wave of amplitude 8, and Gaussian noise with standard deviation 2.

The first 76 observations (days 0–75) are history. The final 14 observations (days 76–89) are the unseen evaluation interval: a single 14-day forecast made after day 75. Both methods use history only. This is not a streaming or intraday forecasting experiment, and the fixture contains no external records.

rng = random.Random(SEED)
days = list(range(90))
volume = [60 + .2*t + 8*math.sin(2*math.pi*t/7) + rng.gauss(0, 2) for t in days]
train, truth = volume[:-HORIZON], volume[-HORIZON:]
assert len(train) >= 14 and len(truth) == HORIZON
assert all(math.isfinite(x) and x >= 0 for x in volume)
print({'observations': len(volume), 'training': len(train), 'holdout': len(truth), 'units': 'review cases/day'})
{'observations': 90, 'training': 76, 'holdout': 14, 'units': 'review cases/day'}

The Weekly baseline repeats the final seven observed values twice. The Drift adjusted candidate estimates daily drift as the difference between the means of the final and first observed weeks, divided by the distance between those weeks (len(history) - 7). It adds seven days of estimated drift to the first forecast week and fourteen days to the second.

Both methods see exactly the same 76 observations. This transparent Python baseline has no learned checkpoint and does not emulate a foundation model.

def predict(history, horizon):
if len(history) < 14 or horizon < 1:
raise ValueError('At least two weeks of history and a positive horizon are required')
if not all(math.isfinite(x) for x in history):
raise ValueError('Missing or infinite observations need an explicit data-quality decision')
weekly = [history[-7:][i % 7] for i in range(horizon)]
daily_drift = (statistics.mean(history[-7:]) - statistics.mean(history[:7])) / (len(history)-7)
adjusted = [value + daily_drift*7*(i//7+1) for i, value in enumerate(weekly)]
return {'Weekly baseline': weekly, 'Drift adjusted': adjusted}
predictions = predict(train, HORIZON)
assert all(len(values) == len(truth) for values in predictions.values())

MAE is the mean absolute error over the final 14 days, in review cases/day. The saved outputs report Weekly baseline: 2.216 and Drift adjusted: 1.870. Those displayed values are rounded; the saved JSON receipt retains the underlying precision.

The shaded interval covers zero-based days 76–89, the 77th through 90th observations. Neither method uses those values when predicting. The candidate benefits from a trend that continues in this generated series; a trend reversal could change the result. One synthetic split is not a benchmark or evidence of real-world superiority.

metrics = {name: statistics.mean(abs(a-b) for a,b in zip(truth,values))
for name,values in predictions.items()}
for name, mae in metrics.items():
print(f'{name}: MAE = {mae:.3f} cases/day')
fig, ax = plt.subplots(figsize=(10, 4))
ax.plot(days, volume, label='Synthetic observed volume', color='#171817')
for name, values in predictions.items():
ax.plot(days[-HORIZON:], values, label=name)
ax.axvspan(len(train)-.5, len(volume)-.5, alpha=.1, color='#1a7f64', label='Holdout')
ax.set(xlabel='Day', ylabel='Review cases/day', title='The same unseen future for both methods')
ax.legend(); fig.tight_layout(); plt.show()
winner = min(metrics, key=metrics.get)
display(Markdown(f'**Observed in this execution:** {winner} has the lowest MAE. This is not proof of general superiority.'))
Weekly baseline: MAE = 2.216 cases/day
Drift adjusted: MAE = 1.870 cases/day
0 20 40 60 80 Day 50 55 60 65 70 75 80 85 Review cases/day The same unseen future for both methods Synthetic observed volume Weekly baseline Drift adjusted Holdout
Holdout comparison (zero-based days 76–89): the drift-adjusted comparator tracks the upward trend better than the static weekly repeat baseline on this synthetic series.

Observed in this execution: Drift adjusted has the lowest MAE. This is not proof of general superiority.

Assume an unfilled case of capacity costs four units and unused capacity costs one. These are teaching assumptions, not dollars or validated savings. Predictions are clipped at zero for the capacity calculation, not for MAE.

Across this 14-day holdout, the saved costs are 103.93 assumed units for the weekly baseline and 44.74 assumed units for the drift-adjusted candidate. Comparing forecast error with decision cost illustrates that these are separate objectives. A real decision would need an independently validated policy and an accountable human owner; this notebook performs no staffing change.

costs = {}
for name, values in predictions.items():
costs[name] = sum(4*max(actual-max(0,predicted),0) + max(max(0,predicted)-actual,0)
for actual,predicted in zip(truth,values))
print(f'{name}: assumed cost = {costs[name]:.2f} units')
display(Markdown('**Human review:** compare missed demand, unused capacity and the cost assumptions before proposing a pilot. No staffing change is performed.'))
Weekly baseline: assumed cost = 103.93 units
Drift adjusted: assumed cost = 44.74 units

Human review: compare missed demand, unused capacity and the cost assumptions before proposing a pilot. No staffing change is performed.

The saved failure probe replaces one historical value with NaN and catches the expected ValueError. It demonstrates input rejection, not comprehensive validation of an operational system.

For independent practice, introduce a trend reversal after the split and explain which method fails. Keep that counterfactual separate from the saved results below. Repeatedly tuning against this displayed holdout would make it unsuitable as unseen evaluation data.

broken = train.copy()
broken[10] = float('nan')
try:
predict(broken, HORIZON)
except ValueError as error:
print('EXPECTED REJECTION:', error)
else:
raise AssertionError('Invalid input was accepted')
EXPECTED REJECTION: Missing or infinite observations need an explicit data-quality decision

This is an original synthetic example with no external dataset or pretrained checkpoint. The saved execution demonstrates these calculations on one generated series; it does not establish improved enterprise outcomes, service levels, or staffing savings. Model results never authorize production actions.

The following JSON is preserved from the earlier execution, alongside the original saved outputs. It was not generated by the renderer or rerun for this editorial update. The source code below computes the receipt from the notebook’s variables; no expected measurements have been substituted.

display(JSON({'observations': len(volume), 'holdout': len(truth), 'seed': SEED,
'provenance': 'original synthetic teaching data',
'model': 'transparent drift-adjusted baseline',
'mae': metrics, 'assumed_cost': costs}))
{
  "assumed_cost": {
    "Drift adjusted": 44.73828549629849,
    "Weekly baseline": 103.9272092056002
  },
  "holdout": 14,
  "mae": {
    "Drift adjusted": 1.8699052402514411,
    "Weekly baseline": 2.215922860645823
  },
  "model": "transparent drift-adjusted baseline",
  "observations": 90,
  "provenance": "original synthetic teaching data",
  "seed": 42
}