zerosuum commited on
Commit
27e7d04
·
verified ·
1 Parent(s): 93fb186

Publish frozen RestockIQ demand artifact and evaluation

Browse files
README.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: lightgbm
3
+ tags:
4
+ - lightgbm
5
+ - retail
6
+ - demand-forecasting
7
+ - quantile-regression
8
+ - inventory
9
+ ---
10
+
11
+ # RestockIQ Demand v1
12
+
13
+ Frozen LightGBM artifact used by the RestockIQ semifinal product for stockout-censored demand reconstruction and direct cumulative quantile forecasting.
14
+
15
+ ## Artifact identity
16
+
17
+ - Version: `restockiq-demand-v1-a067286b7c1e`
18
+ - Production Git SHA evaluated: `06ae958730f87cc44b3a5dbb7094fb8a3c88f7a3`
19
+ - Training dataset ID: `demo-retail-v1`
20
+ - Training cutoff: `2024-05-31`
21
+ - Training data hash: `a067286b7c1e966de43f3db9e1d24a7f8a440d236d94c24365c6d717ca44399c`
22
+ - Seed: `20260723`
23
+ - Artifact files covered by the supplied checksum manifest: 11
24
+ - Oracle fields used as model features: none
25
+
26
+ ## Components
27
+
28
+ The artifact contains:
29
+
30
+ 1. One causal stockout-censor reconstruction model trained with uncensored observed sales as its label.
31
+ 2. Nine direct cumulative quantile models: H1, H7, and H14 × Q10, Q50, and Q90.
32
+ 3. Frozen feature medians and split-conformal interval adjustments in `manifest.json`.
33
+ 4. Inference-time clipping and quantile-order repair in the RestockIQ application code.
34
+
35
+ The cumulative target contract is demand from `t+1` through `t+H`; the decision-origin day is not part of its own label.
36
+
37
+ ## Controlled synthetic evaluation
38
+
39
+ The supplied `evaluation/` directory was produced by the standalone evaluator against the pinned production Git SHA and frozen workbook. The evaluator imports the production snapshot builder, feature engineering, artifact loader, and inference path. Predictions are generated before the synthetic Oracle label is joined.
40
+
41
+ Evaluation window: June 2024. Label: synthetic latent demand `units_demanded_est`, used for evaluation only. The benchmark contains 10,540 store–SKU–origin–horizon prediction rows.
42
+
43
+ | Horizon | Q50 MAE | Q50 RMSE | Q50 WMAPE | Best tested baseline WMAPE | Relative result vs best baseline | Q10–Q90 coverage |
44
+ |---:|---:|---:|---:|---:|---:|---:|
45
+ | H1 | 2.384 | 3.590 | 31.33% | 32.68% (Croston) | +4.14% | 78.64% |
46
+ | H7 | 9.563 | 14.722 | 18.19% | 17.48% (28-day moving average) | −4.10% | 81.07% |
47
+ | H14 | 14.259 | 20.992 | 13.49% | 14.42% (28-day moving average) | +6.46% | 83.15% |
48
+
49
+ There were zero quantile-crossing rows after the production inference repair. The frozen Q50 model beats the strongest tested causal baseline at H1 and H14, while the 28-day moving-average baseline remains stronger at H7. This mixed result is retained intentionally.
50
+
51
+ ## Intended use
52
+
53
+ - Frozen controlled RestockIQ demo inference.
54
+ - Reproduction of the supplied June 2024 synthetic evaluation.
55
+ - Inspection of the model and Oracle-safe feature contract.
56
+
57
+ The artifact is not a general pretrained retail model and does not perform live retraining.
58
+
59
+ ## Out-of-scope use and claims
60
+
61
+ Do not use this artifact or its evaluation to claim:
62
+
63
+ - proven generalization to real merchants or arbitrary POS systems;
64
+ - realized stockout reduction;
65
+ - inventory-cost reduction;
66
+ - service-level improvement;
67
+ - savings, revenue uplift, or ROI;
68
+ - causal promotional effects.
69
+
70
+ Supplier risk, LMAR, WCAR, and the exact sparse-DP allocator are downstream RestockIQ components. They are not outputs or submodels of these LightGBM files.
71
+
72
+ ## Oracle and leakage boundary
73
+
74
+ The frozen manifest declares these fields as forbidden model features:
75
+
76
+ - `units_demanded_est`
77
+ - `demand_profile`
78
+ - `avg_daily_demand_per_store`
79
+ - `cash_locked_in_stock_rp`
80
+
81
+ Realized future supplier outcomes are likewise excluded from decision-time inputs. Oracle data is permitted only after prediction for controlled evaluation and value decomposition.
82
+
83
+ ## Files
84
+
85
+ - `manifest.json`
86
+ - `SHA256SUMS`
87
+ - `reconstruction_censor_no_inventory.txt`
88
+ - `forecast_h1_q10.txt`, `forecast_h1_q50.txt`, `forecast_h1_q90.txt`
89
+ - `forecast_h7_q10.txt`, `forecast_h7_q50.txt`, `forecast_h7_q90.txt`
90
+ - `forecast_h14_q10.txt`, `forecast_h14_q50.txt`, `forecast_h14_q90.txt`
91
+ - `evaluation/`: predictions, point metrics, quantile diagnostics, baseline comparison, run manifest, summary, and checksums
92
+
93
+ ## Verification
94
+
95
+ From the model repository root:
96
+
97
+ ```bash
98
+ sha256sum -c SHA256SUMS
99
+ cd evaluation && sha256sum -c SHA256SUMS
100
+ ```
101
+
102
+ The evaluation manifest records the exact Git SHA, workbook checksum, training cutoff, model version, target timing, baseline definitions, and claim limitations.
103
+
104
+ No license is asserted in this card because the project team has not frozen a licensing decision.
SHA256SUMS ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ b62a311a1273f3918d4127cbfae3d0891ee52bc2c3e5f749ea0d96db8c4c3869 forecast_h14_q10.txt
2
+ 57388956ae19e285081191702e3a63241a3a963659f7418221bdfc430838aa71 forecast_h14_q50.txt
3
+ c4ca1f4dc09d4ec752b8edae02418586975620d77f35890c34988e5388313226 forecast_h14_q90.txt
4
+ 5c55e2b88f28c9515166bcd494f9c8244defa5e7f48817fa40da5a28990b0fdf forecast_h1_q10.txt
5
+ 0b76a0775d09bde3f08315573b954bb32e1a104a992fcf87ccdf582f31b3acb1 forecast_h1_q50.txt
6
+ 3fe56e903d41ddfc604c3ec7ed0f43a5ae84c3ebce4fb505ce08252a077090fc forecast_h1_q90.txt
7
+ fd88d57346167401ca7d87f6b328a2ca2c940c2511fa86b351f032e6cf1822d0 forecast_h7_q10.txt
8
+ 1394cea95589cf09ce3dae5224046c4b2a7aa4a5286643bb8ccfb1605799b985 forecast_h7_q50.txt
9
+ e03ccea57647d48b7b397cba42f30b9a0c8dffcd32b4333deaaa5617c88c771f forecast_h7_q90.txt
10
+ c3689bdf67ecb25edb5927584641446374a4feffad686fcd7d44ff6bf73561ac manifest.json
11
+ 762dbcf51d11aa2c2372d768ddea947a5496a8f1b805dc94e94daeb4285a907c reconstruction_censor_no_inventory.txt
evaluation/EVALUATION_SUMMARY.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RestockIQ Frozen-Artifact Forecast Evaluation
2
+
3
+ **Status:** controlled synthetic evaluation completed.
4
+
5
+ - Git SHA: `06ae958730f87cc44b3a5dbb7094fb8a3c88f7a3`
6
+ - Model: `restockiq-demand-v1-a067286b7c1e`
7
+ - Training cutoff: `2024-05-31`
8
+ - Workbook SHA-256: `9d13eb22b2d2a2acecc46661d4984420e8390861a3bf9c0590cae57f9f5858e0`
9
+ - Prediction rows: `10,540`
10
+ - Target: synthetic Oracle demand over `t+1..t+H`.
11
+ - Oracle fields used as model features: `none`.
12
+
13
+ ## Point metrics
14
+
15
+ | horizon_days | model | n | actual_sum | prediction_sum | mae | rmse | wmape | wmape_percent | bias | mape_nonzero | mape_nonzero_percent | zero_actual_rows |
16
+ |---------------:|:-------------------|-----:|-------------:|-----------------:|--------:|--------:|--------:|----------------:|--------:|---------------:|-----------------------:|-------------------:|
17
+ | 1 | frozen_product_q50 | 4495 | 34205.0000 | 32949.6510 | 2.3840 | 3.5900 | 0.3133 | 31.3292 | -0.2793 | 0.4535 | 45.3474 | 490 |
18
+ | 1 | croston_01 | 4495 | 34205.0000 | 33740.3413 | 2.4870 | 3.7331 | 0.3268 | 32.6819 | -0.1034 | 0.4583 | 45.8291 | 490 |
19
+ | 1 | ewma_28d | 4495 | 34205.0000 | 33446.0336 | 2.4879 | 3.7463 | 0.3269 | 32.6946 | -0.1688 | 0.4678 | 46.7847 | 490 |
20
+ | 1 | moving_average_28d | 4495 | 34205.0000 | 33481.3929 | 2.4919 | 3.7661 | 0.3275 | 32.7474 | -0.1610 | 0.4687 | 46.8670 | 490 |
21
+ | 1 | seasonal_naive_7d | 4495 | 34205.0000 | 33266.0000 | 3.5989 | 5.6172 | 0.4729 | 47.2943 | -0.2089 | 0.6664 | 66.6439 | 490 |
22
+ | 7 | moving_average_28d | 3565 | 187365.0000 | 187087.5000 | 9.1864 | 13.8617 | 0.1748 | 17.4790 | -0.0778 | 0.2736 | 27.3642 | 20 |
23
+ | 7 | ewma_28d | 3565 | 187365.0000 | 187022.9146 | 9.2788 | 13.9711 | 0.1765 | 17.6549 | -0.0960 | 0.2757 | 27.5737 | 20 |
24
+ | 7 | croston_01 | 3565 | 187365.0000 | 188970.3744 | 9.3552 | 14.0816 | 0.1780 | 17.8002 | 0.4503 | 0.2617 | 26.1677 | 20 |
25
+ | 7 | frozen_product_q50 | 3565 | 187365.0000 | 192259.3795 | 9.5626 | 14.7218 | 0.1819 | 18.1949 | 1.3729 | 0.2503 | 25.0326 | 20 |
26
+ | 7 | seasonal_naive_7d | 3565 | 187365.0000 | 184417.0000 | 12.1930 | 18.8103 | 0.2320 | 23.1996 | -0.8269 | 0.3479 | 34.7891 | 20 |
27
+ | 14 | frozen_product_q50 | 2480 | 262170.0000 | 275222.3106 | 14.2593 | 20.9916 | 0.1349 | 13.4886 | 5.2630 | 0.1859 | 18.5941 | 1 |
28
+ | 14 | moving_average_28d | 2480 | 262170.0000 | 260609.5000 | 15.2433 | 23.5362 | 0.1442 | 14.4195 | -0.6292 | 0.2200 | 22.0016 | 1 |
29
+ | 14 | ewma_28d | 2480 | 262170.0000 | 262470.1210 | 15.9431 | 24.7648 | 0.1508 | 15.0814 | 0.1210 | 0.2254 | 22.5446 | 1 |
30
+ | 14 | croston_01 | 2480 | 262170.0000 | 265900.6234 | 16.2052 | 24.9653 | 0.1533 | 15.3294 | 1.5043 | 0.2013 | 20.1350 | 1 |
31
+ | 14 | seasonal_naive_7d | 2480 | 262170.0000 | 256412.0000 | 23.4339 | 36.7922 | 0.2217 | 22.1673 | -2.3218 | 0.3118 | 31.1787 | 1 |
32
+
33
+ ## Quantile diagnostics
34
+
35
+ | horizon_days | n | coverage_80 | coverage_80_percent | mean_interval_width | pinball_q10 | pinball_q50 | pinball_q90 | quantile_crossing_rows |
36
+ |---------------:|----------:|--------------:|----------------------:|----------------------:|--------------:|--------------:|--------------:|-------------------------:|
37
+ | 1.0000 | 4495.0000 | 0.7864 | 78.6429 | 7.0365 | 0.4401 | 1.1920 | 0.6113 | 0.0000 |
38
+ | 7.0000 | 3565.0000 | 0.8107 | 81.0659 | 27.9154 | 1.6744 | 4.7813 | 2.1715 | 0.0000 |
39
+ | 14.0000 | 2480.0000 | 0.8315 | 83.1452 | 47.4906 | 2.6250 | 7.1297 | 3.4248 | 0.0000 |
40
+
41
+ ## Comparison with the strongest tested baseline
42
+
43
+ | horizon_days | product_wmape_percent | best_baseline | best_baseline_wmape_percent | relative_wmape_improvement_vs_best_baseline_percent | product_beats_best_baseline |
44
+ |---------------:|------------------------:|:-------------------|------------------------------:|------------------------------------------------------:|:------------------------------|
45
+ | 1 | 31.3292 | croston_01 | 32.6819 | 4.1389 | True |
46
+ | 7 | 18.1949 | moving_average_28d | 17.4790 | -4.0958 | False |
47
+ | 14 | 13.4886 | moving_average_28d | 14.4195 | 6.4555 | True |
48
+
49
+ ## Claim boundary
50
+
51
+ These results validate the pinned forecasting artifact only on the controlled synthetic June 2024 window. They do not demonstrate realized stockout reduction, savings, revenue uplift, service-level improvement, ROI, or generalization to real merchants.
evaluation/SHA256SUMS ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ 55b21bbb44f3b65869f297b2e91e4c2fcb28ea76b9e2eb25b2d1b531b0dc2ee0 EVALUATION_SUMMARY.md
2
+ 8313a3a9e96f8eca646b596f8c858ff9860bf0f0a2684044cb5cb6cc0eb1cc64 baseline_comparison.csv
3
+ 2af9dc873572ce23fd6caa70166b083870326130ca5bf250676840d4478050bf evaluate_frozen_forecasts.py
4
+ 81d39e9671ce1b55c8018ff125cc3823143cac953c7dc7f455eb4fc6ac982e53 metrics.csv
5
+ 442e8689dae314af374e4bf14b887ea25cc0a9003ef7b22992f957a5b54266c6 metrics.json
6
+ 6d4f1b6a32315fee435f918fc4d7eda9d13975781daa009b4b5dbee65e045710 metrics_by_store.csv
7
+ 7c4d0dc495f1ded845d37763cb3478687b7d8ba8525a5456678743c1be4808a1 predictions.csv
8
+ 4a800bd78d0a114e0b38805619c4a90bcf5c3d70b549271331477fbfe22a328f quantile_metrics.csv
9
+ 590c19bbe3167e29cf95821ef0c8c6b507b049b76db86a8a1a2b94290a8cf808 run_manifest.json
evaluation/baseline_comparison.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ horizon_days,product_wmape_percent,best_baseline,best_baseline_wmape_percent,relative_wmape_improvement_vs_best_baseline_percent,product_beats_best_baseline
2
+ 1,31.32924441023557,croston_01,32.681909132204524,4.138879147167244,True
3
+ 7,18.194885275997084,moving_average_28d,17.478984869105755,-4.095777942783671,False
4
+ 14,13.488613887038298,moving_average_28d,14.419460655299996,6.455489497934565,True
evaluation/evaluate_frozen_forecasts.py ADDED
@@ -0,0 +1,557 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Evaluate RestockIQ's frozen production forecast artifacts on June 2024.
3
+
4
+ This runner deliberately imports the production snapshot builder, feature
5
+ engineering, artifact loader, and inference code from the pinned Git checkout.
6
+ Oracle latent demand is loaded separately and used only after predictions have
7
+ been produced.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import argparse
13
+ import hashlib
14
+ import json
15
+ import math
16
+ import os
17
+ import platform
18
+ import shutil
19
+ import subprocess
20
+ import sys
21
+ import tempfile
22
+ from datetime import date, timedelta
23
+ from pathlib import Path
24
+ from typing import Any
25
+
26
+ import numpy as np
27
+ import pandas as pd
28
+ import lightgbm as lgb
29
+ import sqlalchemy
30
+ from sqlalchemy import create_engine
31
+ from sqlalchemy.orm import Session
32
+
33
+
34
+ DEFAULT_EXPECTED_GIT_SHA = "06ae958730f87cc44b3a5dbb7094fb8a3c88f7a3"
35
+ DEFAULT_EXPECTED_WORKBOOK_SHA256 = (
36
+ "9d13eb22b2d2a2acecc46661d4984420e8390861a3bf9c0590cae57f9f5858e0"
37
+ )
38
+ DATASET_ID = "demo-retail-v1"
39
+ HORIZONS = (1, 7, 14)
40
+ EVALUATION_START = date(2024, 6, 1)
41
+ EVALUATION_END = date(2024, 6, 30)
42
+ ORACLE_LABEL = "units_demanded_est"
43
+ ORACLE_FORBIDDEN_FEATURES = {
44
+ "avg_daily_demand_per_store",
45
+ "cash_locked_in_stock_rp",
46
+ "demand_profile",
47
+ "units_demanded_est",
48
+ }
49
+
50
+
51
+ def sha256_file(path: Path) -> str:
52
+ digest = hashlib.sha256()
53
+ with path.open("rb") as handle:
54
+ for block in iter(lambda: handle.read(1024 * 1024), b""):
55
+ digest.update(block)
56
+ return digest.hexdigest()
57
+
58
+
59
+ def git_output(repo_root: Path, *args: str) -> str:
60
+ return subprocess.check_output(
61
+ ["git", "-C", str(repo_root), *args], text=True
62
+ ).strip()
63
+
64
+
65
+ def croston_daily(history: np.ndarray, alpha: float = 0.1) -> float:
66
+ """Causal Croston estimate after consuming all supplied observations."""
67
+ level = 0.0
68
+ interval = 1.0
69
+ elapsed = 0
70
+ initialized = False
71
+ for value in np.asarray(history, dtype=float):
72
+ elapsed += 1
73
+ if value > 0:
74
+ if not initialized:
75
+ level = float(value)
76
+ interval = float(max(elapsed, 1))
77
+ initialized = True
78
+ else:
79
+ level = alpha * float(value) + (1.0 - alpha) * level
80
+ interval = alpha * float(elapsed) + (1.0 - alpha) * interval
81
+ elapsed = 0
82
+ return max(0.0, level / interval) if initialized and interval > 0 else 0.0
83
+
84
+
85
+ def causal_baselines(history: pd.Series, horizon: int) -> dict[str, float]:
86
+ values = pd.to_numeric(history, errors="coerce").fillna(0).clip(lower=0)
87
+ if values.empty:
88
+ return {
89
+ "seasonal_naive_7d": 0.0,
90
+ "moving_average_28d": 0.0,
91
+ "ewma_28d": 0.0,
92
+ "croston_01": 0.0,
93
+ }
94
+
95
+ last_week = values.tail(7).to_numpy(dtype=float)
96
+ seasonal = float(
97
+ sum(last_week[index % len(last_week)] for index in range(horizon))
98
+ )
99
+ moving_average = float(values.tail(28).mean() * horizon)
100
+ ewma = float(
101
+ values.ewm(span=28, adjust=False, min_periods=1).mean().iloc[-1]
102
+ * horizon
103
+ )
104
+ croston = float(croston_daily(values.to_numpy(dtype=float)) * horizon)
105
+ return {
106
+ "seasonal_naive_7d": seasonal,
107
+ "moving_average_28d": moving_average,
108
+ "ewma_28d": ewma,
109
+ "croston_01": croston,
110
+ }
111
+
112
+
113
+ def regression_metrics(actual: np.ndarray, prediction: np.ndarray) -> dict[str, Any]:
114
+ y = np.asarray(actual, dtype=float)
115
+ p = np.asarray(prediction, dtype=float)
116
+ error = p - y
117
+ nonzero = y != 0
118
+ return {
119
+ "n": int(len(y)),
120
+ "actual_sum": float(y.sum()),
121
+ "prediction_sum": float(p.sum()),
122
+ "mae": float(np.mean(np.abs(error))),
123
+ "rmse": float(np.sqrt(np.mean(np.square(error)))),
124
+ "wmape": float(np.abs(error).sum() / max(np.abs(y).sum(), 1e-12)),
125
+ "wmape_percent": float(
126
+ 100.0 * np.abs(error).sum() / max(np.abs(y).sum(), 1e-12)
127
+ ),
128
+ "bias": float(np.mean(error)),
129
+ "mape_nonzero": (
130
+ float(np.mean(np.abs(error[nonzero] / y[nonzero])))
131
+ if bool(nonzero.any())
132
+ else None
133
+ ),
134
+ "mape_nonzero_percent": (
135
+ float(100.0 * np.mean(np.abs(error[nonzero] / y[nonzero])))
136
+ if bool(nonzero.any())
137
+ else None
138
+ ),
139
+ "zero_actual_rows": int((~nonzero).sum()),
140
+ }
141
+
142
+
143
+ def pinball(actual: np.ndarray, prediction: np.ndarray, alpha: float) -> float:
144
+ residual = np.asarray(actual, dtype=float) - np.asarray(prediction, dtype=float)
145
+ return float(np.mean(np.maximum(alpha * residual, (alpha - 1.0) * residual)))
146
+
147
+
148
+ def atomic_json(path: Path, value: Any) -> None:
149
+ temp = path.with_suffix(path.suffix + ".tmp")
150
+ temp.write_text(json.dumps(value, indent=2, sort_keys=True) + "\n")
151
+ temp.replace(path)
152
+
153
+
154
+ def parse_args() -> argparse.Namespace:
155
+ parser = argparse.ArgumentParser(
156
+ description="Exact-artifact RestockIQ forecast evaluation"
157
+ )
158
+ parser.add_argument("--repo-root", type=Path, required=True)
159
+ parser.add_argument("--output-dir", type=Path, required=True)
160
+ parser.add_argument("--workbook", type=Path)
161
+ parser.add_argument(
162
+ "--expected-git-sha", default=DEFAULT_EXPECTED_GIT_SHA
163
+ )
164
+ parser.add_argument(
165
+ "--expected-workbook-sha256", default=DEFAULT_EXPECTED_WORKBOOK_SHA256
166
+ )
167
+ return parser.parse_args()
168
+
169
+
170
+ def main() -> None:
171
+ args = parse_args()
172
+ repo_root = args.repo_root.expanduser().resolve()
173
+ output_dir = args.output_dir.expanduser().resolve()
174
+ workbook = (
175
+ args.workbook.expanduser().resolve()
176
+ if args.workbook
177
+ else repo_root
178
+ / "backend"
179
+ / "data"
180
+ / "synthetic"
181
+ / "RestockIQ_Dataset_Sintetis.xlsx"
182
+ )
183
+ artifact_dir = repo_root / "backend" / "artifacts" / "restockiq-demand-v1"
184
+
185
+ if not (repo_root / ".git").exists():
186
+ raise SystemExit(f"Not a Git checkout: {repo_root}")
187
+ if not workbook.is_file():
188
+ raise SystemExit(f"Workbook not found: {workbook}")
189
+ if not (artifact_dir / "manifest.json").is_file():
190
+ raise SystemExit(f"Frozen artifact manifest not found: {artifact_dir}")
191
+
192
+ git_sha = git_output(repo_root, "rev-parse", "HEAD")
193
+ if git_sha != args.expected_git_sha:
194
+ raise SystemExit(
195
+ f"Git SHA mismatch: expected {args.expected_git_sha}, got {git_sha}. "
196
+ "Do not silently evaluate another release."
197
+ )
198
+ workbook_sha = sha256_file(workbook)
199
+ if workbook_sha != args.expected_workbook_sha256:
200
+ raise SystemExit(
201
+ "Workbook SHA-256 mismatch: "
202
+ f"expected {args.expected_workbook_sha256}, got {workbook_sha}"
203
+ )
204
+
205
+ backend_root = repo_root / "backend"
206
+ sys.path.insert(0, str(backend_root))
207
+ os.environ.setdefault("DATABASE_URL", "sqlite:///:memory:")
208
+
209
+ from app.db.seed import seed
210
+ from app.ml.artifact_store import load_model_artifacts
211
+ from app.ml.demand_engine import generate_demand_forecasts
212
+ from app.services.retail_snapshot_service import build_retail_snapshot
213
+
214
+ artifacts = load_model_artifacts(artifact_dir, force_reload=True)
215
+ manifest = artifacts.manifest
216
+ used_oracle = set(manifest.get("oracle_fields_used_as_features", []))
217
+ if used_oracle:
218
+ raise SystemExit(f"Artifact manifest declares Oracle features: {used_oracle}")
219
+ declared_features = set(artifacts.reconstruction_feature_columns)
220
+ for artifact in artifacts.forecasts.values():
221
+ declared_features.update(artifact.feature_columns)
222
+ leaked_features = declared_features & ORACLE_FORBIDDEN_FEATURES
223
+ if leaked_features:
224
+ raise SystemExit(f"Oracle feature leak detected: {sorted(leaked_features)}")
225
+ if manifest.get("training_cutoff") != "2024-05-31":
226
+ raise SystemExit(
227
+ f"Unexpected training cutoff: {manifest.get('training_cutoff')}"
228
+ )
229
+
230
+ sales = pd.read_excel(workbook, sheet_name="Fact_Daily_Sales")
231
+ stores = pd.read_excel(workbook, sheet_name="Dim_Stores")
232
+ sales["date"] = pd.to_datetime(sales["date"]).dt.date
233
+ required_columns = {
234
+ "date",
235
+ "store_id",
236
+ "sku_id",
237
+ "units_sold",
238
+ ORACLE_LABEL,
239
+ }
240
+ missing_columns = required_columns - set(sales.columns)
241
+ if missing_columns:
242
+ raise SystemExit(f"Workbook missing evaluation columns: {missing_columns}")
243
+
244
+ origin_end = EVALUATION_END - timedelta(days=min(HORIZONS))
245
+ origins = list(
246
+ pd.date_range(EVALUATION_START, origin_end, freq="D").date
247
+ )
248
+ prediction_rows: list[dict[str, Any]] = []
249
+
250
+ with tempfile.TemporaryDirectory(prefix="restockiq-eval-") as temp_dir:
251
+ database_path = Path(temp_dir) / "evaluation.sqlite3"
252
+ database_url = f"sqlite:///{database_path}"
253
+ seed(database_url=database_url, workbook_path=workbook)
254
+ engine = create_engine(database_url)
255
+
256
+ with Session(engine) as db:
257
+ for origin_index, origin in enumerate(origins, start=1):
258
+ eligible_horizons = [
259
+ horizon
260
+ for horizon in HORIZONS
261
+ if origin + timedelta(days=horizon) <= EVALUATION_END
262
+ ]
263
+ if not eligible_horizons:
264
+ continue
265
+ print(
266
+ f"[{origin_index:02d}/{len(origins):02d}] origin={origin} "
267
+ f"horizons={eligible_horizons}",
268
+ flush=True,
269
+ )
270
+
271
+ for store_id in stores["store_id"].astype(str).sort_values():
272
+ snapshot = build_retail_snapshot(
273
+ db,
274
+ dataset_id=DATASET_ID,
275
+ store_id=store_id,
276
+ decision_date=origin,
277
+ horizon_days=max(eligible_horizons),
278
+ lookback_days=182,
279
+ )
280
+ result = generate_demand_forecasts(
281
+ snapshot,
282
+ artifacts,
283
+ horizon_days=max(eligible_horizons),
284
+ )
285
+
286
+ for forecast in result.forecasts:
287
+ sku_id = forecast.sku_id
288
+ sku_history = sales.loc[
289
+ (sales["store_id"].astype(str) == store_id)
290
+ & (sales["sku_id"].astype(str) == sku_id)
291
+ & (sales["date"] <= origin)
292
+ ].sort_values("date")
293
+
294
+ for horizon in eligible_horizons:
295
+ target_start = origin + timedelta(days=1)
296
+ target_end = origin + timedelta(days=horizon)
297
+ target_rows = sales.loc[
298
+ (sales["store_id"].astype(str) == store_id)
299
+ & (sales["sku_id"].astype(str) == sku_id)
300
+ & (sales["date"] >= target_start)
301
+ & (sales["date"] <= target_end)
302
+ ]
303
+ if len(target_rows) != horizon:
304
+ raise SystemExit(
305
+ "Incomplete Oracle target window for "
306
+ f"{origin}/{store_id}/{sku_id}/H{horizon}: "
307
+ f"expected {horizon} rows, got {len(target_rows)}"
308
+ )
309
+ actual = float(target_rows[ORACLE_LABEL].sum())
310
+ quantiles = forecast.forecasts[horizon]
311
+ baselines = causal_baselines(
312
+ sku_history["units_sold"], horizon
313
+ )
314
+ prediction_rows.append(
315
+ {
316
+ "decision_date": origin.isoformat(),
317
+ "target_start": target_start.isoformat(),
318
+ "target_end": target_end.isoformat(),
319
+ "store_id": store_id,
320
+ "sku_id": sku_id,
321
+ "horizon_days": horizon,
322
+ "actual_oracle_demand": actual,
323
+ "frozen_product_q10": quantiles.q10,
324
+ "frozen_product_q50": quantiles.q50,
325
+ "frozen_product_q90": quantiles.q90,
326
+ **baselines,
327
+ "model_version": result.model_version,
328
+ "training_cutoff": manifest["training_cutoff"],
329
+ "git_sha": git_sha,
330
+ }
331
+ )
332
+
333
+ predictions = pd.DataFrame(prediction_rows).sort_values(
334
+ ["horizon_days", "decision_date", "store_id", "sku_id"],
335
+ kind="stable",
336
+ )
337
+ if predictions.empty:
338
+ raise SystemExit("Evaluation produced no prediction rows")
339
+
340
+ expected_rows = sum(
341
+ (
342
+ EVALUATION_END
343
+ - (EVALUATION_START + timedelta(days=horizon))
344
+ ).days
345
+ + 1
346
+ for horizon in HORIZONS
347
+ ) * len(stores) * sales["sku_id"].nunique()
348
+ if len(predictions) != expected_rows:
349
+ raise SystemExit(
350
+ f"Unexpected prediction count: expected {expected_rows}, "
351
+ f"got {len(predictions)}"
352
+ )
353
+
354
+ point_models = [
355
+ "frozen_product_q50",
356
+ "seasonal_naive_7d",
357
+ "moving_average_28d",
358
+ "ewma_28d",
359
+ "croston_01",
360
+ ]
361
+ metric_rows: list[dict[str, Any]] = []
362
+ store_metric_rows: list[dict[str, Any]] = []
363
+ quantile_rows: list[dict[str, Any]] = []
364
+
365
+ for horizon, frame in predictions.groupby("horizon_days", sort=True):
366
+ y = frame["actual_oracle_demand"].to_numpy(dtype=float)
367
+ for model_name in point_models:
368
+ metrics = regression_metrics(
369
+ y, frame[model_name].to_numpy(dtype=float)
370
+ )
371
+ metric_rows.append(
372
+ {"horizon_days": int(horizon), "model": model_name, **metrics}
373
+ )
374
+
375
+ q10 = frame["frozen_product_q10"].to_numpy(dtype=float)
376
+ q50 = frame["frozen_product_q50"].to_numpy(dtype=float)
377
+ q90 = frame["frozen_product_q90"].to_numpy(dtype=float)
378
+ crossing_rows = int(((q10 > q50) | (q50 > q90)).sum())
379
+ quantile_rows.append(
380
+ {
381
+ "horizon_days": int(horizon),
382
+ "n": int(len(frame)),
383
+ "coverage_80": float(np.mean((y >= q10) & (y <= q90))),
384
+ "coverage_80_percent": float(
385
+ 100.0 * np.mean((y >= q10) & (y <= q90))
386
+ ),
387
+ "mean_interval_width": float(np.mean(q90 - q10)),
388
+ "pinball_q10": pinball(y, q10, 0.10),
389
+ "pinball_q50": pinball(y, q50, 0.50),
390
+ "pinball_q90": pinball(y, q90, 0.90),
391
+ "quantile_crossing_rows": crossing_rows,
392
+ }
393
+ )
394
+
395
+ for store_id, store_frame in frame.groupby("store_id", sort=True):
396
+ store_y = store_frame["actual_oracle_demand"].to_numpy(dtype=float)
397
+ for model_name in point_models:
398
+ metrics = regression_metrics(
399
+ store_y, store_frame[model_name].to_numpy(dtype=float)
400
+ )
401
+ store_metric_rows.append(
402
+ {
403
+ "horizon_days": int(horizon),
404
+ "store_id": str(store_id),
405
+ "model": model_name,
406
+ **metrics,
407
+ }
408
+ )
409
+
410
+ metrics = pd.DataFrame(metric_rows).sort_values(
411
+ ["horizon_days", "wmape", "model"], kind="stable"
412
+ )
413
+ store_metrics = pd.DataFrame(store_metric_rows).sort_values(
414
+ ["horizon_days", "store_id", "wmape", "model"], kind="stable"
415
+ )
416
+ quantile_metrics = pd.DataFrame(quantile_rows).sort_values("horizon_days")
417
+
418
+ comparisons: list[dict[str, Any]] = []
419
+ for horizon, frame in metrics.groupby("horizon_days", sort=True):
420
+ product = frame.loc[frame["model"] == "frozen_product_q50"].iloc[0]
421
+ baselines = frame.loc[frame["model"] != "frozen_product_q50"]
422
+ best = baselines.sort_values("wmape", kind="stable").iloc[0]
423
+ comparisons.append(
424
+ {
425
+ "horizon_days": int(horizon),
426
+ "product_wmape_percent": float(product["wmape_percent"]),
427
+ "best_baseline": str(best["model"]),
428
+ "best_baseline_wmape_percent": float(best["wmape_percent"]),
429
+ "relative_wmape_improvement_vs_best_baseline_percent": float(
430
+ 100.0 * (best["wmape"] - product["wmape"]) / best["wmape"]
431
+ ),
432
+ "product_beats_best_baseline": bool(product["wmape"] < best["wmape"]),
433
+ }
434
+ )
435
+ comparison_frame = pd.DataFrame(comparisons)
436
+
437
+ output_dir.mkdir(parents=True, exist_ok=True)
438
+ evaluator_copy = output_dir / "evaluate_frozen_forecasts.py"
439
+ shutil.copy2(Path(__file__).resolve(), evaluator_copy)
440
+ predictions_path = output_dir / "predictions.csv"
441
+ metrics_path = output_dir / "metrics.csv"
442
+ store_metrics_path = output_dir / "metrics_by_store.csv"
443
+ quantile_path = output_dir / "quantile_metrics.csv"
444
+ comparison_path = output_dir / "baseline_comparison.csv"
445
+ predictions.to_csv(predictions_path, index=False)
446
+ metrics.to_csv(metrics_path, index=False)
447
+ store_metrics.to_csv(store_metrics_path, index=False)
448
+ quantile_metrics.to_csv(quantile_path, index=False)
449
+ comparison_frame.to_csv(comparison_path, index=False)
450
+
451
+ manifest_out = {
452
+ "evaluation_name": "RestockIQ exact frozen-artifact June 2024 evaluation",
453
+ "status": "completed_synthetic_controlled_evaluation",
454
+ "git_sha": git_sha,
455
+ "git_remote": git_output(repo_root, "remote", "get-url", "origin"),
456
+ "git_status_porcelain": git_output(repo_root, "status", "--porcelain=v1"),
457
+ "evaluator_sha256": sha256_file(evaluator_copy),
458
+ "artifact_manifest_sha256": sha256_file(artifact_dir / "manifest.json"),
459
+ "workbook": workbook.name,
460
+ "workbook_sha256": workbook_sha,
461
+ "dataset_id": DATASET_ID,
462
+ "evaluation_period": [
463
+ EVALUATION_START.isoformat(),
464
+ EVALUATION_END.isoformat(),
465
+ ],
466
+ "origin_rule": "decision date t; target is Oracle t+1 through t+H",
467
+ "label": ORACLE_LABEL,
468
+ "label_role": "synthetic Oracle evaluation-only; never a model feature",
469
+ "model_version": artifacts.version,
470
+ "training_cutoff": manifest["training_cutoff"],
471
+ "training_data_hash": manifest["training_data_hash"],
472
+ "oracle_fields_used_as_features": sorted(used_oracle),
473
+ "horizons": list(HORIZONS),
474
+ "stores": int(len(stores)),
475
+ "skus": int(sales["sku_id"].nunique()),
476
+ "prediction_rows": int(len(predictions)),
477
+ "runtime_versions": {
478
+ "python": platform.python_version(),
479
+ "numpy": np.__version__,
480
+ "pandas": pd.__version__,
481
+ "scipy": __import__("scipy").__version__,
482
+ "lightgbm": lgb.__version__,
483
+ "sqlalchemy": sqlalchemy.__version__,
484
+ },
485
+ "baseline_definitions": {
486
+ "seasonal_naive_7d": "repeat the last seven observed-sales days causally",
487
+ "moving_average_28d": "28-day observed-sales mean times H",
488
+ "ewma_28d": "causal span-28 observed-sales EWMA times H",
489
+ "croston_01": "causal Croston alpha=0.1 daily rate times H",
490
+ },
491
+ "limitations": [
492
+ "Synthetic controlled evaluation; not evidence of real merchant impact.",
493
+ "Oracle latent demand is used only as an evaluation label.",
494
+ "Metrics apply to the pinned frozen artifact and workbook only.",
495
+ "No stockout reduction, savings, revenue, ROI, or service-level claim is produced.",
496
+ ],
497
+ }
498
+ atomic_json(output_dir / "run_manifest.json", manifest_out)
499
+
500
+ metrics_payload = {
501
+ "point_metrics": metrics.to_dict(orient="records"),
502
+ "quantile_metrics": quantile_metrics.to_dict(orient="records"),
503
+ "baseline_comparison": comparison_frame.to_dict(orient="records"),
504
+ }
505
+ atomic_json(output_dir / "metrics.json", metrics_payload)
506
+
507
+ summary_lines = [
508
+ "# RestockIQ Frozen-Artifact Forecast Evaluation",
509
+ "",
510
+ "**Status:** controlled synthetic evaluation completed.",
511
+ "",
512
+ f"- Git SHA: `{git_sha}`",
513
+ f"- Model: `{artifacts.version}`",
514
+ f"- Training cutoff: `{manifest['training_cutoff']}`",
515
+ f"- Workbook SHA-256: `{workbook_sha}`",
516
+ f"- Prediction rows: `{len(predictions):,}`",
517
+ "- Target: synthetic Oracle demand over `t+1..t+H`.",
518
+ "- Oracle fields used as model features: `none`.",
519
+ "",
520
+ "## Point metrics",
521
+ "",
522
+ metrics.to_markdown(index=False, floatfmt=".4f"),
523
+ "",
524
+ "## Quantile diagnostics",
525
+ "",
526
+ quantile_metrics.to_markdown(index=False, floatfmt=".4f"),
527
+ "",
528
+ "## Comparison with the strongest tested baseline",
529
+ "",
530
+ comparison_frame.to_markdown(index=False, floatfmt=".4f"),
531
+ "",
532
+ "## Claim boundary",
533
+ "",
534
+ "These results validate the pinned forecasting artifact only on the controlled synthetic June 2024 window. They do not demonstrate realized stockout reduction, savings, revenue uplift, service-level improvement, ROI, or generalization to real merchants.",
535
+ "",
536
+ ]
537
+ (output_dir / "EVALUATION_SUMMARY.md").write_text("\n".join(summary_lines))
538
+
539
+ checksum_files = sorted(
540
+ path
541
+ for path in output_dir.iterdir()
542
+ if path.is_file() and path.name != "SHA256SUMS"
543
+ )
544
+ (output_dir / "SHA256SUMS").write_text(
545
+ "\n".join(f"{sha256_file(path)} {path.name}" for path in checksum_files)
546
+ + "\n"
547
+ )
548
+
549
+ print("\nEvaluation completed.")
550
+ print(metrics.to_string(index=False))
551
+ print("\nQuantile diagnostics:")
552
+ print(quantile_metrics.to_string(index=False))
553
+ print(f"\nOutputs: {output_dir}")
554
+
555
+
556
+ if __name__ == "__main__":
557
+ main()
evaluation/metrics.csv ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ horizon_days,model,n,actual_sum,prediction_sum,mae,rmse,wmape,wmape_percent,bias,mape_nonzero,mape_nonzero_percent,zero_actual_rows
2
+ 1,frozen_product_q50,4495,34205.0,32949.650997892764,2.384019588547514,3.5900039276845876,0.3132924441023557,31.32924441023557,-0.2792767524154025,0.4534735875060879,45.34735875060879,490
3
+ 1,croston_01,4495,34205.0,33740.34127127988,2.4869515058221485,3.733116825548437,0.3268190913220453,32.681909132204524,-0.10337235344162793,0.4582907852729936,45.82907852729936,490
4
+ 1,ewma_28d,4495,34205.0,33446.03356122295,2.4879196310025415,3.746266449425722,0.32694631607532304,32.6946316075323,-0.1688468161906683,0.4678467136548258,46.78467136548258,490
5
+ 1,moving_average_28d,4495,34205.0,33481.392857142855,2.4919354838709675,3.7660556155675997,0.32747405350095016,32.747405350095015,-0.1609804544732242,0.4686702849658086,46.86702849658086,490
6
+ 1,seasonal_naive_7d,4495,34205.0,33266.0,3.59888765294772,5.617210958687039,0.47294255225844173,47.294255225844175,-0.2088987764182425,0.666438714609271,66.6438714609271,490
7
+ 7,moving_average_28d,3565,187365.0,187087.5,9.186395511921459,13.86165996952744,0.17478984869105757,17.478984869105755,-0.07784011220196353,0.27364156081096036,27.364156081096034,20
8
+ 7,ewma_28d,3565,187365.0,187022.9146295055,9.278825931204487,13.97110566879584,0.17654852531019133,17.65485253101913,-0.09595662566465389,0.275737212515037,27.573721251503702,20
9
+ 7,croston_01,3565,187365.0,188970.37438391318,9.355235873067242,14.081569695165259,0.17800237978002678,17.800237978002677,0.4503153952070647,0.26167706853457445,26.167706853457446,20
10
+ 7,frozen_product_q50,3565,187365.0,192259.37951985394,9.562649873035607,14.72181875410442,0.18194885275997086,18.194885275997084,1.3728974810249464,0.2503262474408005,25.03262474408005,20
11
+ 7,seasonal_naive_7d,3565,187365.0,184417.0,12.192987377279103,18.81026546746541,0.23199637072025192,23.19963707202519,-0.8269284712482469,0.34789095468512293,34.78909546851229,20
12
+ 14,frozen_product_q50,2480,262170.0,275222.310598772,14.259314124051736,20.991553718900008,0.13488613887038298,13.488613887038298,5.263028467246779,0.18594104321190352,18.59410432119035,1
13
+ 14,moving_average_28d,2480,262170.0,260609.5,15.243346774193549,23.536208806857573,0.14419460655299995,14.419460655299996,-0.629233870967742,0.22001623227049832,22.001623227049834,1
14
+ 14,ewma_28d,2480,262170.0,262470.12103139434,15.943116721579381,24.764835084808933,0.1508140880707818,15.08140880707818,0.12101654491706937,0.22544594877913723,22.544594877913724,1
15
+ 14,croston_01,2480,262170.0,265900.62338449893,16.2052416115614,24.965328108267574,0.15329366135207032,15.32936613520703,1.5042836227818297,0.20134957293100236,20.134957293100236,1
16
+ 14,seasonal_naive_7d,2480,262170.0,256412.0,23.433870967741935,36.79224585206385,0.2216729602929397,22.16729602929397,-2.321774193548387,0.3117871657569443,31.17871657569443,1
evaluation/metrics.json ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "baseline_comparison": [
3
+ {
4
+ "best_baseline": "croston_01",
5
+ "best_baseline_wmape_percent": 32.681909132204524,
6
+ "horizon_days": 1,
7
+ "product_beats_best_baseline": true,
8
+ "product_wmape_percent": 31.32924441023557,
9
+ "relative_wmape_improvement_vs_best_baseline_percent": 4.138879147167244
10
+ },
11
+ {
12
+ "best_baseline": "moving_average_28d",
13
+ "best_baseline_wmape_percent": 17.478984869105755,
14
+ "horizon_days": 7,
15
+ "product_beats_best_baseline": false,
16
+ "product_wmape_percent": 18.194885275997084,
17
+ "relative_wmape_improvement_vs_best_baseline_percent": -4.095777942783671
18
+ },
19
+ {
20
+ "best_baseline": "moving_average_28d",
21
+ "best_baseline_wmape_percent": 14.419460655299996,
22
+ "horizon_days": 14,
23
+ "product_beats_best_baseline": true,
24
+ "product_wmape_percent": 13.488613887038298,
25
+ "relative_wmape_improvement_vs_best_baseline_percent": 6.455489497934565
26
+ }
27
+ ],
28
+ "point_metrics": [
29
+ {
30
+ "actual_sum": 34205.0,
31
+ "bias": -0.2792767524154025,
32
+ "horizon_days": 1,
33
+ "mae": 2.384019588547514,
34
+ "mape_nonzero": 0.4534735875060879,
35
+ "mape_nonzero_percent": 45.34735875060879,
36
+ "model": "frozen_product_q50",
37
+ "n": 4495,
38
+ "prediction_sum": 32949.650997892764,
39
+ "rmse": 3.5900039276845876,
40
+ "wmape": 0.3132924441023557,
41
+ "wmape_percent": 31.32924441023557,
42
+ "zero_actual_rows": 490
43
+ },
44
+ {
45
+ "actual_sum": 34205.0,
46
+ "bias": -0.10337235344162793,
47
+ "horizon_days": 1,
48
+ "mae": 2.4869515058221485,
49
+ "mape_nonzero": 0.4582907852729936,
50
+ "mape_nonzero_percent": 45.82907852729936,
51
+ "model": "croston_01",
52
+ "n": 4495,
53
+ "prediction_sum": 33740.34127127988,
54
+ "rmse": 3.733116825548437,
55
+ "wmape": 0.3268190913220453,
56
+ "wmape_percent": 32.681909132204524,
57
+ "zero_actual_rows": 490
58
+ },
59
+ {
60
+ "actual_sum": 34205.0,
61
+ "bias": -0.1688468161906683,
62
+ "horizon_days": 1,
63
+ "mae": 2.4879196310025415,
64
+ "mape_nonzero": 0.4678467136548258,
65
+ "mape_nonzero_percent": 46.78467136548258,
66
+ "model": "ewma_28d",
67
+ "n": 4495,
68
+ "prediction_sum": 33446.03356122295,
69
+ "rmse": 3.746266449425722,
70
+ "wmape": 0.32694631607532304,
71
+ "wmape_percent": 32.6946316075323,
72
+ "zero_actual_rows": 490
73
+ },
74
+ {
75
+ "actual_sum": 34205.0,
76
+ "bias": -0.1609804544732242,
77
+ "horizon_days": 1,
78
+ "mae": 2.4919354838709675,
79
+ "mape_nonzero": 0.4686702849658086,
80
+ "mape_nonzero_percent": 46.86702849658086,
81
+ "model": "moving_average_28d",
82
+ "n": 4495,
83
+ "prediction_sum": 33481.392857142855,
84
+ "rmse": 3.7660556155675997,
85
+ "wmape": 0.32747405350095016,
86
+ "wmape_percent": 32.747405350095015,
87
+ "zero_actual_rows": 490
88
+ },
89
+ {
90
+ "actual_sum": 34205.0,
91
+ "bias": -0.2088987764182425,
92
+ "horizon_days": 1,
93
+ "mae": 3.59888765294772,
94
+ "mape_nonzero": 0.666438714609271,
95
+ "mape_nonzero_percent": 66.6438714609271,
96
+ "model": "seasonal_naive_7d",
97
+ "n": 4495,
98
+ "prediction_sum": 33266.0,
99
+ "rmse": 5.617210958687039,
100
+ "wmape": 0.47294255225844173,
101
+ "wmape_percent": 47.294255225844175,
102
+ "zero_actual_rows": 490
103
+ },
104
+ {
105
+ "actual_sum": 187365.0,
106
+ "bias": -0.07784011220196353,
107
+ "horizon_days": 7,
108
+ "mae": 9.186395511921459,
109
+ "mape_nonzero": 0.27364156081096036,
110
+ "mape_nonzero_percent": 27.364156081096034,
111
+ "model": "moving_average_28d",
112
+ "n": 3565,
113
+ "prediction_sum": 187087.5,
114
+ "rmse": 13.86165996952744,
115
+ "wmape": 0.17478984869105757,
116
+ "wmape_percent": 17.478984869105755,
117
+ "zero_actual_rows": 20
118
+ },
119
+ {
120
+ "actual_sum": 187365.0,
121
+ "bias": -0.09595662566465389,
122
+ "horizon_days": 7,
123
+ "mae": 9.278825931204487,
124
+ "mape_nonzero": 0.275737212515037,
125
+ "mape_nonzero_percent": 27.573721251503702,
126
+ "model": "ewma_28d",
127
+ "n": 3565,
128
+ "prediction_sum": 187022.9146295055,
129
+ "rmse": 13.97110566879584,
130
+ "wmape": 0.17654852531019133,
131
+ "wmape_percent": 17.65485253101913,
132
+ "zero_actual_rows": 20
133
+ },
134
+ {
135
+ "actual_sum": 187365.0,
136
+ "bias": 0.4503153952070647,
137
+ "horizon_days": 7,
138
+ "mae": 9.355235873067242,
139
+ "mape_nonzero": 0.26167706853457445,
140
+ "mape_nonzero_percent": 26.167706853457446,
141
+ "model": "croston_01",
142
+ "n": 3565,
143
+ "prediction_sum": 188970.37438391318,
144
+ "rmse": 14.081569695165259,
145
+ "wmape": 0.17800237978002678,
146
+ "wmape_percent": 17.800237978002677,
147
+ "zero_actual_rows": 20
148
+ },
149
+ {
150
+ "actual_sum": 187365.0,
151
+ "bias": 1.3728974810249464,
152
+ "horizon_days": 7,
153
+ "mae": 9.562649873035607,
154
+ "mape_nonzero": 0.2503262474408005,
155
+ "mape_nonzero_percent": 25.03262474408005,
156
+ "model": "frozen_product_q50",
157
+ "n": 3565,
158
+ "prediction_sum": 192259.37951985394,
159
+ "rmse": 14.72181875410442,
160
+ "wmape": 0.18194885275997086,
161
+ "wmape_percent": 18.194885275997084,
162
+ "zero_actual_rows": 20
163
+ },
164
+ {
165
+ "actual_sum": 187365.0,
166
+ "bias": -0.8269284712482469,
167
+ "horizon_days": 7,
168
+ "mae": 12.192987377279103,
169
+ "mape_nonzero": 0.34789095468512293,
170
+ "mape_nonzero_percent": 34.78909546851229,
171
+ "model": "seasonal_naive_7d",
172
+ "n": 3565,
173
+ "prediction_sum": 184417.0,
174
+ "rmse": 18.81026546746541,
175
+ "wmape": 0.23199637072025192,
176
+ "wmape_percent": 23.19963707202519,
177
+ "zero_actual_rows": 20
178
+ },
179
+ {
180
+ "actual_sum": 262170.0,
181
+ "bias": 5.263028467246779,
182
+ "horizon_days": 14,
183
+ "mae": 14.259314124051736,
184
+ "mape_nonzero": 0.18594104321190352,
185
+ "mape_nonzero_percent": 18.59410432119035,
186
+ "model": "frozen_product_q50",
187
+ "n": 2480,
188
+ "prediction_sum": 275222.310598772,
189
+ "rmse": 20.991553718900008,
190
+ "wmape": 0.13488613887038298,
191
+ "wmape_percent": 13.488613887038298,
192
+ "zero_actual_rows": 1
193
+ },
194
+ {
195
+ "actual_sum": 262170.0,
196
+ "bias": -0.629233870967742,
197
+ "horizon_days": 14,
198
+ "mae": 15.243346774193549,
199
+ "mape_nonzero": 0.22001623227049832,
200
+ "mape_nonzero_percent": 22.001623227049834,
201
+ "model": "moving_average_28d",
202
+ "n": 2480,
203
+ "prediction_sum": 260609.5,
204
+ "rmse": 23.536208806857573,
205
+ "wmape": 0.14419460655299995,
206
+ "wmape_percent": 14.419460655299996,
207
+ "zero_actual_rows": 1
208
+ },
209
+ {
210
+ "actual_sum": 262170.0,
211
+ "bias": 0.12101654491706937,
212
+ "horizon_days": 14,
213
+ "mae": 15.943116721579381,
214
+ "mape_nonzero": 0.22544594877913723,
215
+ "mape_nonzero_percent": 22.544594877913724,
216
+ "model": "ewma_28d",
217
+ "n": 2480,
218
+ "prediction_sum": 262470.12103139434,
219
+ "rmse": 24.764835084808933,
220
+ "wmape": 0.1508140880707818,
221
+ "wmape_percent": 15.08140880707818,
222
+ "zero_actual_rows": 1
223
+ },
224
+ {
225
+ "actual_sum": 262170.0,
226
+ "bias": 1.5042836227818297,
227
+ "horizon_days": 14,
228
+ "mae": 16.2052416115614,
229
+ "mape_nonzero": 0.20134957293100236,
230
+ "mape_nonzero_percent": 20.134957293100236,
231
+ "model": "croston_01",
232
+ "n": 2480,
233
+ "prediction_sum": 265900.62338449893,
234
+ "rmse": 24.965328108267574,
235
+ "wmape": 0.15329366135207032,
236
+ "wmape_percent": 15.32936613520703,
237
+ "zero_actual_rows": 1
238
+ },
239
+ {
240
+ "actual_sum": 262170.0,
241
+ "bias": -2.321774193548387,
242
+ "horizon_days": 14,
243
+ "mae": 23.433870967741935,
244
+ "mape_nonzero": 0.3117871657569443,
245
+ "mape_nonzero_percent": 31.17871657569443,
246
+ "model": "seasonal_naive_7d",
247
+ "n": 2480,
248
+ "prediction_sum": 256412.0,
249
+ "rmse": 36.79224585206385,
250
+ "wmape": 0.2216729602929397,
251
+ "wmape_percent": 22.16729602929397,
252
+ "zero_actual_rows": 1
253
+ }
254
+ ],
255
+ "quantile_metrics": [
256
+ {
257
+ "coverage_80": 0.7864293659621802,
258
+ "coverage_80_percent": 78.64293659621802,
259
+ "horizon_days": 1,
260
+ "mean_interval_width": 7.03646395143773,
261
+ "n": 4495,
262
+ "pinball_q10": 0.44014761984234607,
263
+ "pinball_q50": 1.192009794273757,
264
+ "pinball_q90": 0.6113398602007618,
265
+ "quantile_crossing_rows": 0
266
+ },
267
+ {
268
+ "coverage_80": 0.8106591865357644,
269
+ "coverage_80_percent": 81.06591865357645,
270
+ "horizon_days": 7,
271
+ "mean_interval_width": 27.915441224950428,
272
+ "n": 3565,
273
+ "pinball_q10": 1.6743619017525346,
274
+ "pinball_q50": 4.781324936517803,
275
+ "pinball_q90": 2.1715224487756313,
276
+ "quantile_crossing_rows": 0
277
+ },
278
+ {
279
+ "coverage_80": 0.8314516129032258,
280
+ "coverage_80_percent": 83.14516129032258,
281
+ "horizon_days": 14,
282
+ "mean_interval_width": 47.49057793632384,
283
+ "n": 2480,
284
+ "pinball_q10": 2.6250437142517526,
285
+ "pinball_q50": 7.129657062025868,
286
+ "pinball_q90": 3.4247838153423285,
287
+ "quantile_crossing_rows": 0
288
+ }
289
+ ]
290
+ }
evaluation/metrics_by_store.csv ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ horizon_days,store_id,model,n,actual_sum,prediction_sum,mae,rmse,wmape,wmape_percent,bias,mape_nonzero,mape_nonzero_percent,zero_actual_rows
2
+ 1,S01,frozen_product_q50,899,7547.0,7008.038742326617,2.5935169972314185,4.097968219941704,0.3089402120724851,30.894021207248514,-0.5995119662662783,0.4651960112731215,46.51960112731215,96
3
+ 1,S01,moving_average_28d,899,7547.0,7342.928571428571,2.605434609883998,4.151300048569791,0.3103598402392625,31.03598402392625,-0.2269982520260607,0.4771929584471576,47.71929584471576,96
4
+ 1,S01,ewma_28d,899,7547.0,7362.376898207124,2.6298176935207134,4.170678840704454,0.31326435755599863,31.32643575559986,-0.20536496306215377,0.4811680586963763,48.11680586963763,96
5
+ 1,S01,croston_01,899,7547.0,7396.6709013561,2.650207908828989,4.181784577878802,0.31569324367791984,31.56932436779198,-0.1672181297484979,0.4743040774308254,47.43040774308254,96
6
+ 1,S01,seasonal_naive_7d,899,7547.0,7327.0,3.7508342602892104,5.9195571490555245,0.4468000530011925,44.680005300119255,-0.2447163515016685,0.6705668920662955,67.05668920662956,96
7
+ 1,S02,frozen_product_q50,899,6169.0,6103.558551832481,2.274512112540314,3.3969334573158525,0.33146156413904077,33.14615641390408,-0.07279360196609436,0.4635122679287246,46.35122679287246,113
8
+ 1,S02,moving_average_28d,899,6169.0,6006.714285714286,2.2812648975051646,3.499202132455104,0.3324456383298984,33.24456383298984,-0.18051803591291904,0.4518102445684703,45.18102445684703,113
9
+ 1,S02,ewma_28d,899,6169.0,6002.653776014198,2.293449404968332,3.4823627409463374,0.33422127007076197,33.4221270070762,-0.18503473190856704,0.4535604213156051,45.35604213156051,113
10
+ 1,S02,croston_01,899,6169.0,6076.74820783173,2.3225944847590476,3.495677079445841,0.33846854300508733,33.84685430050874,-0.10261600908595044,0.4492188728839176,44.92188728839176,113
11
+ 1,S02,seasonal_naive_7d,899,6169.0,6034.0,3.460511679644049,5.358660201451128,0.5042956719079267,50.429567190792675,-0.15016685205784205,0.6690980777354153,66.90980777354153,113
12
+ 1,S03,frozen_product_q50,899,6257.0,6229.845008838718,2.3843499402369037,3.598903799876326,0.3425812044546869,34.2581204454687,-0.03020577437295042,0.4735864467733925,47.35864467733925,114
13
+ 1,S03,moving_average_28d,899,6257.0,6219.464285714286,2.4517320832671223,3.6887882107886094,0.3522626087353593,35.22626087353593,-0.04175274114095024,0.479831986762188,47.983198676218805,114
14
+ 1,S03,ewma_28d,899,6257.0,6190.993647285974,2.4544359508713565,3.684497263279992,0.352651097943639,35.2651097943639,-0.0734219718732212,0.4809204149858744,48.09204149858744,114
15
+ 1,S03,croston_01,899,6257.0,6301.400825248424,2.4544722616158445,3.706680413873509,0.35265631503798056,35.265631503798055,0.049389127083898025,0.46934171807236413,46.93417180723641,114
16
+ 1,S03,seasonal_naive_7d,899,6257.0,6228.0,3.589543937708565,5.759066943337441,0.5157423685472271,51.57423685472271,-0.03225806451612903,0.6900051406557649,69.0005140655765,114
17
+ 1,S04,frozen_product_q50,899,7372.0,6984.017864335636,2.3921623266663943,3.4669573903120314,0.2917191985449116,29.171919854491158,-0.4315707849436755,0.44372248665884567,44.37224866588457,70
18
+ 1,S04,ewma_28d,899,7372.0,7355.33357793934,2.5086676679494566,3.549284418204959,0.30592678153642994,30.592678153642993,-0.01853884545123516,0.48228832694506796,48.22883269450679,70
19
+ 1,S04,croston_01,899,7372.0,7345.213618088715,2.5155683380088227,3.5656880149124572,0.306768303834771,30.6768303834771,-0.029795752960273716,0.46645502345834206,46.6455023458342,70
20
+ 1,S04,moving_average_28d,899,7372.0,7372.5,2.5306689972985854,3.5964020388789333,0.30860979769010155,30.860979769010154,0.0005561735261400925,0.48596514076779673,48.59651407677967,70
21
+ 1,S04,seasonal_naive_7d,899,7372.0,7218.0,3.597330367074527,5.445043464608839,0.43868692349430277,43.868692349430276,-0.17130144605116795,0.6764235142502553,67.64235142502552,70
22
+ 1,S05,frozen_product_q50,899,6860.0,6624.190830559316,2.2755565660625425,3.337100305934235,0.29821069284114077,29.821069284114074,-0.2623016345280138,0.4222909927185685,42.22909927185685,97
23
+ 1,S05,croston_01,899,6860.0,6620.307718754913,2.4919145358980392,3.676970894110038,0.32656431017089466,32.65643101708947,-0.2666210024973157,0.43189267284396016,43.18926728439602,97
24
+ 1,S05,ewma_28d,899,6860.0,6534.675661776311,2.553227437702849,3.8050242225513657,0.33459933913919265,33.459933913919265,-0.3618735686581641,0.4407856572306093,44.07856572306093,97
25
+ 1,S05,moving_average_28d,899,6860.0,6539.785714285714,2.5905768313999684,3.859650340562184,0.339493960849646,33.9493960849646,-0.3561894168123312,0.4478584565079267,44.78584565079267,97
26
+ 1,S05,seasonal_naive_7d,899,6860.0,6459.0,3.596218020022247,5.585118475654458,0.47128279883381924,47.12827988338192,-0.4460511679644049,0.626311246699029,62.6311246699029,97
27
+ 7,S01,moving_average_28d,713,41207.0,40925.75,8.798387096774194,12.830979259267515,0.1522374839226345,15.22374839226345,-0.3944600280504909,0.2354115586193961,23.54115586193961,9
28
+ 7,S01,ewma_28d,713,41207.0,41047.79068578307,9.005937797512788,13.22935571749057,0.15582870991886374,15.582870991886372,-0.22329497085124014,0.2392031871060224,23.92031871060224,9
29
+ 7,S01,croston_01,713,41207.0,41192.757039714874,9.227868897234726,13.891407339083585,0.15966875831116945,15.966875831116944,-0.019976101381663,0.21748309657291126,21.748309657291127,9
30
+ 7,S01,frozen_product_q50,713,41207.0,40642.93643623597,10.35880972334837,15.758798281771412,0.1792372978558834,17.923729785588343,-0.7911129926564245,0.22757371540125257,22.757371540125256,9
31
+ 7,S01,seasonal_naive_7d,713,41207.0,40685.0,11.708274894810659,17.41531302129633,0.20258693911228676,20.258693911228676,-0.7321178120617111,0.3160898098378841,31.60898098378841,9
32
+ 7,S02,moving_average_28d,713,33852.0,33491.25,8.024894810659186,12.03261186305136,0.1690225097483162,16.90225097483162,-0.5059607293127629,0.28903693390177115,28.903693390177114,8
33
+ 7,S02,ewma_28d,713,33852.0,33523.37178970822,8.277459624942532,12.269187668017189,0.17434209832754416,17.434209832754416,-0.4609091308440112,0.2901937001159493,29.01937001159493,8
34
+ 7,S02,croston_01,713,33852.0,34043.1404597861,8.537787539855438,12.794603097903096,0.17982519543651565,17.982519543651566,0.26807918623576565,0.3055641396760597,30.556413967605973,8
35
+ 7,S02,frozen_product_q50,713,33852.0,35431.11257229469,8.861727075258273,14.116776528571721,0.1866480977389563,18.66480977389563,2.214744140665759,0.2706420937291821,27.064209372918206,8
36
+ 7,S02,seasonal_naive_7d,713,33852.0,33158.0,11.800841514726507,18.045135867353512,0.24855252274607112,24.855252274607114,-0.9733520336605891,0.38526601738669763,38.52660173866976,8
37
+ 7,S03,moving_average_28d,713,34504.0,34844.0,9.326086956521738,13.729638755796032,0.19271678645954093,19.271678645954093,0.47685834502103785,0.3012077032491755,30.12077032491755,3
38
+ 7,S03,ewma_28d,713,34504.0,34859.729017562124,9.728361599425838,14.342939309868816,0.20102949862017802,20.1029498620178,0.49891867820774904,0.31154310335915864,31.154310335915863,3
39
+ 7,S03,croston_01,713,34504.0,35498.68199457943,10.065145216156397,15.193984851812544,0.2079888864803939,20.798888648039387,1.3950659110510883,0.298083921360115,29.808392136011502,3
40
+ 7,S03,frozen_product_q50,713,34504.0,36429.038828024975,10.279213709269445,16.12097617899276,0.21241245579379536,21.241245579379534,2.6999142048036195,0.2802818377205175,28.02818377205175,3
41
+ 7,S03,seasonal_naive_7d,713,34504.0,34819.0,12.730715287517532,19.714120924222485,0.26307094829584976,26.307094829584976,0.4417952314165498,0.38096309226709213,38.09630922670921,3
42
+ 7,S04,ewma_28d,713,40236.0,41130.257515187724,9.540718099803591,13.339377167000292,0.16906581183914804,16.906581183914806,1.2542181138677722,0.2691191327734908,26.911913277349083,0
43
+ 7,S04,croston_01,713,40236.0,41084.83547149017,9.549775147975652,13.715767715145837,0.16922630680253106,16.922630680253107,1.190512582735173,0.2392290342631686,23.92290342631686,0
44
+ 7,S04,moving_average_28d,713,40236.0,41316.25,9.60483870967742,13.349083074656527,0.17020205785863407,17.020205785863407,1.5150771388499298,0.2671855799376947,26.71855799376947,0
45
+ 7,S04,frozen_product_q50,713,40236.0,41138.4585675644,10.261090916277801,14.840325492899849,0.1818311418457618,18.18311418457618,1.265720291114162,0.2510373588293576,25.103735882935762,0
46
+ 7,S04,seasonal_naive_7d,713,40236.0,39926.0,12.746143057503506,18.3856917353974,0.22586738244358287,22.586738244358287,-0.43478260869565216,0.3340551154007905,33.405511540079054,0
47
+ 7,S05,frozen_product_q50,713,37566.0,38617.833115733905,8.052407941024144,12.486612855432128,0.1528341282529472,15.283412825294722,1.475221761197618,0.2221630207982935,22.21630207982935,0
48
+ 7,S05,croston_01,713,37566.0,37150.9594183426,9.395602564114002,14.690149740993796,0.1783278663742023,17.83278663742023,-0.5821046026050404,0.2481129086967657,24.81129086967657,0
49
+ 7,S05,ewma_28d,713,37566.0,36461.76562126438,9.841652534337683,16.332521485070885,0.18679386298734943,18.679386298734943,-1.5487158187035392,0.26847864096622803,26.847864096622803,0
50
+ 7,S05,moving_average_28d,713,37566.0,36510.25,10.177769985974754,16.870367786644785,0.19317334824043017,19.31733482404302,-1.4807152875175316,0.27517218738227195,27.517218738227196,0
51
+ 7,S05,seasonal_naive_7d,713,37566.0,35829.0,11.978962131837307,20.33544084296428,0.22735984666986103,22.735984666986106,-2.4361851332398317,0.323237830553814,32.3237830553814,0
52
+ 14,S01,moving_average_28d,496,57910.0,56841.0,13.433467741935484,20.361179262698464,0.11505784838542565,11.505784838542565,-2.155241935483871,0.20087221940414207,20.087221940414207,0
53
+ 14,S01,frozen_product_q50,496,57910.0,58204.98100863425,13.803100668390389,21.031549461720267,0.11822375982596499,11.8223759825965,0.5947197754722764,0.1718111283038845,17.18111283038845,0
54
+ 14,S01,ewma_28d,496,57910.0,57229.383817786744,14.89455426021201,22.526844871683696,0.12757207586021682,12.757207586021684,-1.3722100447848053,0.2092230354915216,20.92230354915216,0
55
+ 14,S01,croston_01,496,57910.0,57389.357671930295,15.62997130863394,24.325876962672808,0.13387093367436426,13.387093367436426,-1.0496821130437577,0.17939433270515398,17.939433270515398,0
56
+ 14,S01,seasonal_naive_7d,496,57910.0,55812.0,22.70967741935484,34.1754250510415,0.19450872042825074,19.450872042825072,-4.229838709677419,0.3039472313949942,30.39472313949942,0
57
+ 14,S02,frozen_product_q50,496,47264.0,50485.49647920423,12.6444871299441,18.455588418595106,0.13269434699670518,13.269434699670517,6.4949525790407785,0.19921168285096308,19.921168285096307,1
58
+ 14,S02,moving_average_28d,496,47264.0,46641.0,13.088709677419354,19.002387371234477,0.13735612728503724,13.735612728503725,-1.2560483870967742,0.20985079400046414,20.985079400046413,1
59
+ 14,S02,ewma_28d,496,47264.0,47115.379630169635,13.328824055888694,19.283110508285432,0.13987594642266402,13.987594642266403,-0.2996378423999212,0.21514165829371168,21.51416582937117,1
60
+ 14,S02,croston_01,496,47264.0,47905.14761469116,13.717048009688243,20.51881723666265,0.14395006374418942,14.39500637441894,1.292636319941848,0.2163957448947876,21.63957448947876,1
61
+ 14,S02,seasonal_naive_7d,496,47264.0,46480.0,20.181451612903224,31.29155301870747,0.21178909952606634,21.178909952606634,-1.5806451612903225,0.31372179184253124,31.372179184253124,1
62
+ 14,S03,moving_average_28d,496,48373.0,48341.0,15.286290322580646,21.628134678640674,0.15674033034957519,15.674033034957517,-0.06451612903225806,0.24517335676390203,24.517335676390204,0
63
+ 14,S03,frozen_product_q50,496,48373.0,52072.995370655175,16.645790701140122,24.23823940547198,0.1706801767053005,17.06801767053005,7.459668085998339,0.2040305755742317,20.40305755742317,0
64
+ 14,S03,ewma_28d,496,48373.0,48919.650871919985,17.14817225079005,24.645128037230805,0.17583142324006917,17.583142324006918,1.1021186933870668,0.2594107125820982,25.94107125820982,0
65
+ 14,S03,croston_01,496,48373.0,50145.475996192894,18.395445616077378,27.338263577528032,0.18862053264371403,18.862053264371404,3.5735403149050344,0.2379882472200417,23.79882472200417,0
66
+ 14,S03,seasonal_naive_7d,496,48373.0,48464.0,25.941532258064516,39.725088562397474,0.2659954933537304,26.599549335373037,0.18346774193548387,0.3489111337228377,34.89111337228377,0
67
+ 14,S04,frozen_product_q50,496,56240.0,59096.926701870834,15.625830463045663,21.90985715646559,0.13780960010082946,13.780960010082946,5.759932866675063,0.19088058993353935,19.088058993353936,0
68
+ 14,S04,ewma_28d,496,56240.0,58022.70828513917,16.649460454644995,23.838215360892065,0.14683734682617208,14.683734682617207,3.594169929716068,0.22685816963001115,22.685816963001116,0
69
+ 14,S04,croston_01,496,56240.0,58048.0209546545,16.67752361436658,24.696730741936456,0.14708484553210927,14.708484553210926,3.6452035376098877,0.1837238431670304,18.372384316703037,0
70
+ 14,S04,moving_average_28d,496,56240.0,57794.5,16.982862903225808,23.954688829861347,0.14977773826458038,14.977773826458037,3.1340725806451615,0.22591838301476064,22.591838301476063,0
71
+ 14,S04,seasonal_naive_7d,496,56240.0,55674.0,24.302419354838708,35.56150963811766,0.21433143669985774,21.433143669985775,-1.1411290322580645,0.3023863168449406,30.23863168449406,0
72
+ 14,S05,frozen_product_q50,496,52383.0,55361.91103840753,12.577361657738416,18.781845780866554,0.11909152553764112,11.90915255376411,6.005869029047432,0.16379799471875187,16.379799471875188,0
73
+ 14,S05,croston_01,496,52383.0,52412.62114703008,16.60621950904086,27.317736403269404,0.15723965554634645,15.723965554634644,0.05972005449613455,0.18927603169211876,18.927603169211878,0
74
+ 14,S05,moving_average_28d,496,52383.0,50992.0,17.425403225806452,30.862500734919443,0.16499627741824638,16.49962774182464,-2.8044354838709675,0.21824591333400092,21.824591333400093,0
75
+ 14,S05,ewma_28d,496,52383.0,51182.9984263788,17.694572586361154,31.8048006687276,0.16754496693269064,16.75449669326906,-2.4193580113330615,0.21657539311913923,21.657539311913922,0
76
+ 14,S05,seasonal_naive_7d,496,52383.0,49982.0,24.034274193548388,42.17252870553715,0.22757383120478017,22.757383120478018,-4.840725806451613,0.28997325543523567,28.997325543523566,0
evaluation/predictions.csv ADDED
The diff for this file is too large to render. See raw diff
 
evaluation/quantile_metrics.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ horizon_days,n,coverage_80,coverage_80_percent,mean_interval_width,pinball_q10,pinball_q50,pinball_q90,quantile_crossing_rows
2
+ 1,4495,0.7864293659621802,78.64293659621802,7.03646395143773,0.44014761984234607,1.192009794273757,0.6113398602007618,0
3
+ 7,3565,0.8106591865357644,81.06591865357645,27.915441224950428,1.6743619017525346,4.781324936517803,2.1715224487756313,0
4
+ 14,2480,0.8314516129032258,83.14516129032258,47.49057793632384,2.6250437142517526,7.129657062025868,3.4247838153423285,0
evaluation/run_manifest.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "artifact_manifest_sha256": "c3689bdf67ecb25edb5927584641446374a4feffad686fcd7d44ff6bf73561ac",
3
+ "baseline_definitions": {
4
+ "croston_01": "causal Croston alpha=0.1 daily rate times H",
5
+ "ewma_28d": "causal span-28 observed-sales EWMA times H",
6
+ "moving_average_28d": "28-day observed-sales mean times H",
7
+ "seasonal_naive_7d": "repeat the last seven observed-sales days causally"
8
+ },
9
+ "dataset_id": "demo-retail-v1",
10
+ "evaluation_name": "RestockIQ exact frozen-artifact June 2024 evaluation",
11
+ "evaluation_period": [
12
+ "2024-06-01",
13
+ "2024-06-30"
14
+ ],
15
+ "evaluator_sha256": "2af9dc873572ce23fd6caa70166b083870326130ca5bf250676840d4478050bf",
16
+ "git_remote": "https://github.com/Dzakiyaadila/triple-sigma.git",
17
+ "git_sha": "06ae958730f87cc44b3a5dbb7094fb8a3c88f7a3",
18
+ "git_status_porcelain": "",
19
+ "horizons": [
20
+ 1,
21
+ 7,
22
+ 14
23
+ ],
24
+ "label": "units_demanded_est",
25
+ "label_role": "synthetic Oracle evaluation-only; never a model feature",
26
+ "limitations": [
27
+ "Synthetic controlled evaluation; not evidence of real merchant impact.",
28
+ "Oracle latent demand is used only as an evaluation label.",
29
+ "Metrics apply to the pinned frozen artifact and workbook only.",
30
+ "No stockout reduction, savings, revenue, ROI, or service-level claim is produced."
31
+ ],
32
+ "model_version": "restockiq-demand-v1-a067286b7c1e",
33
+ "oracle_fields_used_as_features": [],
34
+ "origin_rule": "decision date t; target is Oracle t+1 through t+H",
35
+ "prediction_rows": 10540,
36
+ "runtime_versions": {
37
+ "lightgbm": "4.7.0",
38
+ "numpy": "2.2.6",
39
+ "pandas": "2.2.3",
40
+ "python": "3.12.13",
41
+ "scipy": "1.14.1",
42
+ "sqlalchemy": "2.0.35"
43
+ },
44
+ "skus": 31,
45
+ "status": "completed_synthetic_controlled_evaluation",
46
+ "stores": 5,
47
+ "training_cutoff": "2024-05-31",
48
+ "training_data_hash": "a067286b7c1e966de43f3db9e1d24a7f8a440d236d94c24365c6d717ca44399c",
49
+ "workbook": "RestockIQ_Dataset_Sintetis.xlsx",
50
+ "workbook_sha256": "9d13eb22b2d2a2acecc46661d4984420e8390861a3bf9c0590cae57f9f5858e0"
51
+ }
forecast_h14_q10.txt ADDED
The diff for this file is too large to render. See raw diff
 
forecast_h14_q50.txt ADDED
The diff for this file is too large to render. See raw diff
 
forecast_h14_q90.txt ADDED
The diff for this file is too large to render. See raw diff
 
forecast_h1_q10.txt ADDED
The diff for this file is too large to render. See raw diff
 
forecast_h1_q50.txt ADDED
The diff for this file is too large to render. See raw diff
 
forecast_h1_q90.txt ADDED
The diff for this file is too large to render. See raw diff
 
forecast_h7_q10.txt ADDED
The diff for this file is too large to render. See raw diff
 
forecast_h7_q50.txt ADDED
The diff for this file is too large to render. See raw diff
 
forecast_h7_q90.txt ADDED
The diff for this file is too large to render. See raw diff
 
manifest.json ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "artifact_schema_version": 1,
3
+ "created_at": "2026-08-08T13:36:18.291254+00:00",
4
+ "forecast_signal": "rolling_origin_reconstructed_demand",
5
+ "forecast_target": "t+1_through_t+H_cumulative_reconstructed_demand",
6
+ "forecasts": {
7
+ "1": {
8
+ "calibration_adjustment": 0.03861231249552724,
9
+ "calibration_date_max": "2024-05-30",
10
+ "calibration_date_min": "2024-05-10",
11
+ "calibration_target": "future_cumulative_reconstructed_demand",
12
+ "feature_columns": [
13
+ "sig_lag_1",
14
+ "sig_lag_2",
15
+ "sig_lag_3",
16
+ "sig_lag_7",
17
+ "sig_lag_14",
18
+ "sig_lag_21",
19
+ "sig_lag_28",
20
+ "sig_roll_mean_7",
21
+ "sig_roll_mean_14",
22
+ "sig_roll_mean_28",
23
+ "sig_roll_std_7",
24
+ "sig_roll_std_14",
25
+ "sig_roll_std_28",
26
+ "sig_zero_rate_7",
27
+ "sig_zero_rate_14",
28
+ "sig_zero_rate_28",
29
+ "promo_flag",
30
+ "is_weekend",
31
+ "is_holiday",
32
+ "is_payday_week",
33
+ "day_of_month",
34
+ "month",
35
+ "unit_cost_rp",
36
+ "unit_price_rp",
37
+ "margin_rp",
38
+ "shelf_life_days",
39
+ "is_perishable",
40
+ "promised_lead_time_days"
41
+ ],
42
+ "medians": {
43
+ "day_of_month": 16.0,
44
+ "is_holiday": 0.0,
45
+ "is_payday_week": 0.0,
46
+ "is_perishable": 0.0,
47
+ "is_weekend": 0.0,
48
+ "margin_rp": 4787.0,
49
+ "month": 3.0,
50
+ "promised_lead_time_days": 3.0,
51
+ "promo_flag": 0.0,
52
+ "shelf_life_days": 292.0,
53
+ "sig_lag_1": 5.0,
54
+ "sig_lag_14": 5.0,
55
+ "sig_lag_2": 5.0,
56
+ "sig_lag_21": 5.0,
57
+ "sig_lag_28": 5.0,
58
+ "sig_lag_3": 5.0,
59
+ "sig_lag_7": 5.0,
60
+ "sig_roll_mean_14": 5.7005760535559915,
61
+ "sig_roll_mean_28": 5.857142857142857,
62
+ "sig_roll_mean_7": 5.428571428571429,
63
+ "sig_roll_std_14": 2.400970831230673,
64
+ "sig_roll_std_28": 2.514245129542576,
65
+ "sig_roll_std_7": 2.217355782608345,
66
+ "sig_zero_rate_14": 0.0,
67
+ "sig_zero_rate_28": 0.0,
68
+ "sig_zero_rate_7": 0.0,
69
+ "unit_cost_rp": 31339.0,
70
+ "unit_price_rp": 35700.0
71
+ },
72
+ "model_files": {
73
+ "0.10": "forecast_h1_q10.txt",
74
+ "0.50": "forecast_h1_q50.txt",
75
+ "0.90": "forecast_h1_q90.txt"
76
+ },
77
+ "model_fit_date_max": "2024-05-09",
78
+ "training_date_max": "2024-05-30",
79
+ "training_date_min": "2024-01-01",
80
+ "training_rows": 23405
81
+ },
82
+ "14": {
83
+ "calibration_adjustment": 1.5054051780677558,
84
+ "calibration_date_max": "2024-05-17",
85
+ "calibration_date_min": "2024-04-27",
86
+ "calibration_target": "future_cumulative_reconstructed_demand",
87
+ "feature_columns": [
88
+ "sig_lag_1",
89
+ "sig_lag_2",
90
+ "sig_lag_3",
91
+ "sig_lag_7",
92
+ "sig_lag_14",
93
+ "sig_lag_21",
94
+ "sig_lag_28",
95
+ "sig_roll_mean_7",
96
+ "sig_roll_mean_14",
97
+ "sig_roll_mean_28",
98
+ "sig_roll_std_7",
99
+ "sig_roll_std_14",
100
+ "sig_roll_std_28",
101
+ "sig_zero_rate_7",
102
+ "sig_zero_rate_14",
103
+ "sig_zero_rate_28",
104
+ "promo_flag",
105
+ "is_weekend",
106
+ "is_holiday",
107
+ "is_payday_week",
108
+ "day_of_month",
109
+ "month",
110
+ "unit_cost_rp",
111
+ "unit_price_rp",
112
+ "margin_rp",
113
+ "shelf_life_days",
114
+ "is_perishable",
115
+ "promised_lead_time_days"
116
+ ],
117
+ "medians": {
118
+ "day_of_month": 14.0,
119
+ "is_holiday": 0.0,
120
+ "is_payday_week": 0.0,
121
+ "is_perishable": 0.0,
122
+ "is_weekend": 0.0,
123
+ "margin_rp": 4787.0,
124
+ "month": 3.0,
125
+ "promised_lead_time_days": 3.0,
126
+ "promo_flag": 0.0,
127
+ "shelf_life_days": 292.0,
128
+ "sig_lag_1": 5.0,
129
+ "sig_lag_14": 5.0,
130
+ "sig_lag_2": 5.0,
131
+ "sig_lag_21": 5.0,
132
+ "sig_lag_28": 5.0,
133
+ "sig_lag_3": 5.0,
134
+ "sig_lag_7": 5.0,
135
+ "sig_roll_mean_14": 5.656655617050996,
136
+ "sig_roll_mean_28": 5.821428571428571,
137
+ "sig_roll_mean_7": 5.428571428571429,
138
+ "sig_roll_std_14": 2.4074094507812367,
139
+ "sig_roll_std_28": 2.5084924177763783,
140
+ "sig_roll_std_7": 2.225394561056746,
141
+ "sig_zero_rate_14": 0.0,
142
+ "sig_zero_rate_28": 0.0,
143
+ "sig_zero_rate_7": 0.0,
144
+ "unit_cost_rp": 31339.0,
145
+ "unit_price_rp": 35700.0
146
+ },
147
+ "model_files": {
148
+ "0.10": "forecast_h14_q10.txt",
149
+ "0.50": "forecast_h14_q50.txt",
150
+ "0.90": "forecast_h14_q90.txt"
151
+ },
152
+ "model_fit_date_max": "2024-04-26",
153
+ "training_date_max": "2024-05-17",
154
+ "training_date_min": "2024-01-01",
155
+ "training_rows": 21390
156
+ },
157
+ "7": {
158
+ "calibration_adjustment": 1.219129646667811,
159
+ "calibration_date_max": "2024-05-24",
160
+ "calibration_date_min": "2024-05-04",
161
+ "calibration_target": "future_cumulative_reconstructed_demand",
162
+ "feature_columns": [
163
+ "sig_lag_1",
164
+ "sig_lag_2",
165
+ "sig_lag_3",
166
+ "sig_lag_7",
167
+ "sig_lag_14",
168
+ "sig_lag_21",
169
+ "sig_lag_28",
170
+ "sig_roll_mean_7",
171
+ "sig_roll_mean_14",
172
+ "sig_roll_mean_28",
173
+ "sig_roll_std_7",
174
+ "sig_roll_std_14",
175
+ "sig_roll_std_28",
176
+ "sig_zero_rate_7",
177
+ "sig_zero_rate_14",
178
+ "sig_zero_rate_28",
179
+ "promo_flag",
180
+ "is_weekend",
181
+ "is_holiday",
182
+ "is_payday_week",
183
+ "day_of_month",
184
+ "month",
185
+ "unit_cost_rp",
186
+ "unit_price_rp",
187
+ "margin_rp",
188
+ "shelf_life_days",
189
+ "is_perishable",
190
+ "promised_lead_time_days"
191
+ ],
192
+ "medians": {
193
+ "day_of_month": 15.0,
194
+ "is_holiday": 0.0,
195
+ "is_payday_week": 0.0,
196
+ "is_perishable": 0.0,
197
+ "is_weekend": 0.0,
198
+ "margin_rp": 4787.0,
199
+ "month": 3.0,
200
+ "promised_lead_time_days": 3.0,
201
+ "promo_flag": 0.0,
202
+ "shelf_life_days": 292.0,
203
+ "sig_lag_1": 5.0,
204
+ "sig_lag_14": 5.0,
205
+ "sig_lag_2": 5.0,
206
+ "sig_lag_21": 5.0,
207
+ "sig_lag_28": 5.0,
208
+ "sig_lag_3": 5.0,
209
+ "sig_lag_7": 5.0,
210
+ "sig_roll_mean_14": 5.661661141858831,
211
+ "sig_roll_mean_28": 5.850288026777996,
212
+ "sig_roll_mean_7": 5.428571428571429,
213
+ "sig_roll_std_14": 2.4053511772118203,
214
+ "sig_roll_std_28": 2.5058866383772487,
215
+ "sig_roll_std_7": 2.214669705568283,
216
+ "sig_zero_rate_14": 0.0,
217
+ "sig_zero_rate_28": 0.0,
218
+ "sig_zero_rate_7": 0.0,
219
+ "unit_cost_rp": 31339.0,
220
+ "unit_price_rp": 35700.0
221
+ },
222
+ "model_files": {
223
+ "0.10": "forecast_h7_q10.txt",
224
+ "0.50": "forecast_h7_q50.txt",
225
+ "0.90": "forecast_h7_q90.txt"
226
+ },
227
+ "model_fit_date_max": "2024-05-03",
228
+ "training_date_max": "2024-05-24",
229
+ "training_date_min": "2024-01-01",
230
+ "training_rows": 22475
231
+ }
232
+ },
233
+ "horizons": [
234
+ 1,
235
+ 7,
236
+ 14
237
+ ],
238
+ "library_versions": {
239
+ "lightgbm": "4.7.0",
240
+ "numpy": "2.2.6",
241
+ "pandas": "2.2.2"
242
+ },
243
+ "oracle_fields_used_as_features": [],
244
+ "oracle_forbidden_fields": [
245
+ "avg_daily_demand_per_store",
246
+ "cash_locked_in_stock_rp",
247
+ "demand_profile",
248
+ "units_demanded_est"
249
+ ],
250
+ "quantiles": [
251
+ 0.1,
252
+ 0.5,
253
+ 0.9
254
+ ],
255
+ "reconstruction": {
256
+ "feature_columns": [
257
+ "lag_1",
258
+ "lag_2",
259
+ "lag_3",
260
+ "lag_7",
261
+ "lag_14",
262
+ "lag_21",
263
+ "lag_28",
264
+ "roll_mean_7",
265
+ "roll_mean_14",
266
+ "roll_mean_28",
267
+ "roll_std_7",
268
+ "roll_std_14",
269
+ "roll_std_28",
270
+ "zero_rate_7",
271
+ "zero_rate_14",
272
+ "zero_rate_28",
273
+ "ewm_7",
274
+ "ewm_28",
275
+ "past_stockout_rate_28",
276
+ "promo_flag",
277
+ "is_weekend",
278
+ "is_holiday",
279
+ "is_payday_week",
280
+ "day_of_month",
281
+ "month",
282
+ "unit_cost_rp",
283
+ "unit_price_rp",
284
+ "margin_rp",
285
+ "shelf_life_days",
286
+ "is_perishable",
287
+ "promised_lead_time_days"
288
+ ],
289
+ "medians": {
290
+ "day_of_month": 16.0,
291
+ "ewm_28": 5.8243961187092514,
292
+ "ewm_7": 5.13282937654271,
293
+ "is_holiday": 0.0,
294
+ "is_payday_week": 0.0,
295
+ "is_perishable": 0.0,
296
+ "is_weekend": 0.0,
297
+ "lag_1": 5.0,
298
+ "lag_14": 5.0,
299
+ "lag_2": 5.0,
300
+ "lag_21": 5.0,
301
+ "lag_28": 5.0,
302
+ "lag_3": 5.0,
303
+ "lag_7": 5.0,
304
+ "margin_rp": 4787.0,
305
+ "month": 3.0,
306
+ "past_stockout_rate_28": 0.0,
307
+ "promised_lead_time_days": 3.0,
308
+ "promo_flag": 0.0,
309
+ "roll_mean_14": 5.214285714285714,
310
+ "roll_mean_28": 5.464285714285714,
311
+ "roll_mean_7": 5.0,
312
+ "roll_std_14": 2.6196635972272015,
313
+ "roll_std_28": 2.738415182157349,
314
+ "roll_std_7": 2.370453040886408,
315
+ "shelf_life_days": 292.0,
316
+ "unit_cost_rp": 31339.0,
317
+ "unit_price_rp": 35700.0,
318
+ "zero_rate_14": 0.07142857142857142,
319
+ "zero_rate_28": 0.07142857142857142,
320
+ "zero_rate_7": 0.0
321
+ },
322
+ "model_file": "reconstruction_censor_no_inventory.txt",
323
+ "training_rows": 21558
324
+ },
325
+ "reconstruction_label": "uncensored_observed_units_sold",
326
+ "reconstruction_variant": "censor_no_inventory",
327
+ "seed": 20260723,
328
+ "training_cutoff": "2024-05-31",
329
+ "training_data_hash": "a067286b7c1e966de43f3db9e1d24a7f8a440d236d94c24365c6d717ca44399c",
330
+ "training_dataset_id": "demo-retail-v1",
331
+ "version": "restockiq-demand-v1-a067286b7c1e"
332
+ }
reconstruction_censor_no_inventory.txt ADDED
The diff for this file is too large to render. See raw diff