Upload sarimax model with evaluation metrics
Browse files- README.md +40 -0
- metrics.json +19 -0
- model.pkl +3 -0
- model_config.json +54 -0
- predictions.csv +29 -0
README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SARIMAX Model for M5 Demand Forecasting
|
| 2 |
+
|
| 3 |
+
## Overview
|
| 4 |
+
Seasonal ARIMA with eXogenous variables trained on aggregated daily M5 sales data.
|
| 5 |
+
|
| 6 |
+
## Model Details
|
| 7 |
+
- **Architecture**: SARIMAX(2,1,1)(1,1,1,7)
|
| 8 |
+
- **Training Data**: 1,913 days with 6 exogenous features
|
| 9 |
+
- **Test Period**: 28 days (2016-04-25 to 2016-05-22)
|
| 10 |
+
- **Exogenous Variables**: wday, month, snap_CA, snap_TX, snap_WI, has_event
|
| 11 |
+
|
| 12 |
+
## Performance
|
| 13 |
+
| Metric | Value |
|
| 14 |
+
|--------|-------|
|
| 15 |
+
| RMSE | 2,759.70 |
|
| 16 |
+
| MAE | 2,260.25 |
|
| 17 |
+
| MAPE | 4.98% |
|
| 18 |
+
| AIC | 35869.68 |
|
| 19 |
+
|
| 20 |
+
## Key Features
|
| 21 |
+
- Captures autocorrelation and seasonal patterns
|
| 22 |
+
- Exogenous variables provide additional signal
|
| 23 |
+
- Weekly seasonality (s=7) for day-of-week effects
|
| 24 |
+
- Event indicators (holidays, SNAP days) improve accuracy
|
| 25 |
+
|
| 26 |
+
## Usage
|
| 27 |
+
```python
|
| 28 |
+
import pickle
|
| 29 |
+
import pandas as pd
|
| 30 |
+
|
| 31 |
+
with open('model.pkl', 'rb') as f:
|
| 32 |
+
model = pickle.load(f)
|
| 33 |
+
|
| 34 |
+
forecast = model.forecast(steps=28, exog=exog_future)
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## Notes
|
| 38 |
+
- Best performance among the three statistical models
|
| 39 |
+
- Exogenous variables (especially SNAP indicators) significantly improve predictions
|
| 40 |
+
- Larger model size (85MB) due to seasonal components
|
metrics.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"rmse": 2759.696905356552,
|
| 3 |
+
"mae": 2260.247243573586,
|
| 4 |
+
"mape": 4.980222193545587,
|
| 5 |
+
"method": "SARIMAX",
|
| 6 |
+
"order": [
|
| 7 |
+
2,
|
| 8 |
+
1,
|
| 9 |
+
1
|
| 10 |
+
],
|
| 11 |
+
"seasonal_order": [
|
| 12 |
+
1,
|
| 13 |
+
1,
|
| 14 |
+
1,
|
| 15 |
+
7
|
| 16 |
+
],
|
| 17 |
+
"train_days": 1913,
|
| 18 |
+
"test_days": 28
|
| 19 |
+
}
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97c55e424c49326ad5989df42aab3a398158b8fbaa730e0a465ebfcc111c8ffe
|
| 3 |
+
size 89436804
|
model_config.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_name": "SARIMAX",
|
| 3 |
+
"hyperparameters": {
|
| 4 |
+
"order": [
|
| 5 |
+
2,
|
| 6 |
+
1,
|
| 7 |
+
1
|
| 8 |
+
],
|
| 9 |
+
"seasonal_order": [
|
| 10 |
+
1,
|
| 11 |
+
1,
|
| 12 |
+
1,
|
| 13 |
+
7
|
| 14 |
+
],
|
| 15 |
+
"trend": "c",
|
| 16 |
+
"enforce_stationarity": false,
|
| 17 |
+
"enforce_invertibility": false
|
| 18 |
+
},
|
| 19 |
+
"training_data": {
|
| 20 |
+
"train_days": 1913,
|
| 21 |
+
"test_days": 28,
|
| 22 |
+
"train_start": "2011-01-29 00:00:00",
|
| 23 |
+
"train_end": "2016-04-24 00:00:00",
|
| 24 |
+
"exog_features": [
|
| 25 |
+
"wday",
|
| 26 |
+
"month",
|
| 27 |
+
"snap_CA",
|
| 28 |
+
"snap_TX",
|
| 29 |
+
"snap_WI",
|
| 30 |
+
"has_event"
|
| 31 |
+
],
|
| 32 |
+
"aic": 35869.684809082944,
|
| 33 |
+
"bic": 35941.80233095954
|
| 34 |
+
},
|
| 35 |
+
"metrics": {
|
| 36 |
+
"rmse": 2759.696905356552,
|
| 37 |
+
"mae": 2260.247243573586,
|
| 38 |
+
"mape": 4.980222193545587,
|
| 39 |
+
"method": "SARIMAX",
|
| 40 |
+
"order": [
|
| 41 |
+
2,
|
| 42 |
+
1,
|
| 43 |
+
1
|
| 44 |
+
],
|
| 45 |
+
"seasonal_order": [
|
| 46 |
+
1,
|
| 47 |
+
1,
|
| 48 |
+
1,
|
| 49 |
+
7
|
| 50 |
+
],
|
| 51 |
+
"train_days": 1913,
|
| 52 |
+
"test_days": 28
|
| 53 |
+
}
|
| 54 |
+
}
|
predictions.csv
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ds,yhat,actual
|
| 2 |
+
2016-04-25,38805.11936782724,38793
|
| 3 |
+
2016-04-26,36316.105828214844,35487
|
| 4 |
+
2016-04-27,35752.42080290593,34445
|
| 5 |
+
2016-04-28,36582.001356706554,34732
|
| 6 |
+
2016-04-29,40021.65105203574,42896
|
| 7 |
+
2016-04-30,48196.35281505108,50429
|
| 8 |
+
2016-05-01,51530.0262907313,53032
|
| 9 |
+
2016-05-02,41857.07730659572,43181
|
| 10 |
+
2016-05-03,40467.91078918641,44314
|
| 11 |
+
2016-05-04,37463.81561243717,39601
|
| 12 |
+
2016-05-05,39465.26870813444,40763
|
| 13 |
+
2016-05-06,44250.71209230045,43805
|
| 14 |
+
2016-05-07,53019.85674631836,54239
|
| 15 |
+
2016-05-08,51451.157547362236,45609
|
| 16 |
+
2016-05-09,43474.084010331186,46400
|
| 17 |
+
2016-05-10,37953.66045915283,39379
|
| 18 |
+
2016-05-11,38475.18393370119,42248
|
| 19 |
+
2016-05-12,39468.605711146374,40503
|
| 20 |
+
2016-05-13,41414.537439468375,44073
|
| 21 |
+
2016-05-14,51144.72101008925,54308
|
| 22 |
+
2016-05-15,52881.63756486844,59921
|
| 23 |
+
2016-05-16,39205.3841990734,42362
|
| 24 |
+
2016-05-17,36318.56067550168,38777
|
| 25 |
+
2016-05-18,35983.29108237676,37096
|
| 26 |
+
2016-05-19,36979.27362886479,36963
|
| 27 |
+
2016-05-20,40113.330984365224,42552
|
| 28 |
+
2016-05-21,50100.882300414974,51518
|
| 29 |
+
2016-05-22,50390.02911314174,54338
|