Learn how to forecast sporadic demand patterns for inventory management.
unique_id | ds | y | sell_price | event_type_Cultural | event_type_National | event_type_Religious | event_type_Sporting |
---|---|---|---|---|---|---|---|
FOODS_1_001 | 2011-01-29 | 3 | 2.0 | 0 | 0 | 0 | 0 |
FOODS_1_001 | 2011-01-30 | 0 | 2.0 | 0 | 0 | 0 | 0 |
FOODS_1_001 | 2011-01-31 | 0 | 2.0 | 0 | 0 | 0 | 0 |
FOODS_1_001 | 2011-02-01 | 1 | 2.0 | 0 | 0 | 0 | 0 |
FOODS_1_001 | 2011-02-02 | 4 | 2.0 | 0 | 0 | 0 | 0 |
Figure 1: Visualization of intermittent demand data
Step 1: Environment Setup
pandas
, numpy
, and nixtla
before starting.base_url
parameter:Step 2: Load the Dataset
unique_id
, ds
, and y
, plus any exogenous variables (e.g., sell_price
and event details).Step 3: Transform the Data
Perform a Log Transform
Create Train/Test Splits
Step 4: Forecast with TimeGPT
model="azureai"
.
Public API models include timegpt-1
and timegpt-1-long-horizon
.Step 5: Evaluate the Forecasts
Step 6: Compare with Statistical Models
Step 7: Use Exogenous Variables