Skip to main content
ByEliott Kalfon
Spare-parts demand is a panel forecasting problem: related daily series share calendar and operational patterns, but each part and plant also behaves differently. This recipe compares four TabPFNRegressor strategies: one model per series, one per product category, one per location, and a single global model.
The data is synthetic and does not represent any real company’s operations.

Setup and data

A few demand series

The selected series deliberately show different demand regimes: steady consumption, periodic replenishment, strong annual seasonality, and intermittent bulk orders.

Build leakage-safe time-series features

Each target day becomes a tabular row with calendar variables, weekly and annual Fourier terms, lags, and shifted rolling statistics. Every demand-derived feature starts at shift(1), so it uses only information available before the target day.

Hold out four weeks

This is a rolling next-day evaluation: for each test date, the previous day’s observed demand is available. Static labels are one-hot encoded so pooled models can distinguish their member series.

Fit local, grouped, and global models

The helper changes only which rows are pooled. It otherwise uses TabPFNRegressor defaults, requests the predictive mean, and takes the 10th and 90th percentiles as an 80% predictive interval. Constant columns are removed within each pool.

Compare pooling strategies

Forecasts with predictive intervals

Separate panels compare the four strategies on a steady high-volume bearing and a hydraulic filter with periodic replenishment peaks. The dotted line marks the start of the 28-day holdout.

Takeaways

Pooling can help when related series share calendar, maintenance, or plant-level patterns; local models remain useful when a series has enough history and distinct dynamics. Choose the level with repeated rolling backtests, not a single split. For fixed multi-day forecasts, replace this next-day setup with direct-horizon or recursive features, and add known signals such as work orders, installed-base counts, lead times, and stock-outs.