RETAIL ANALYTICS · BY GUSTAVO

Market Insights
& Forecasting

I built this project around a practical retail question: how many paid orders should a fulfilment team expect tomorrow? It turns transaction records into validated datasets, demand forecasts and explanations that support workload planning.

Explore the results
Data after cleaning1.0M+

Positive paid product lines
1,003,214 retained rows

Average daily error9.64

Orders per day
Mean absolute error on the test set

Improvement16.6%

Less forecasting error
Compared with the weekly baseline

Evaluation window112

Chronological test days
15 Aug – 4 Dec 2011

A Forecast Is Useful When It Beats a Clear Baseline

I counted distinct paid UK orders, rather than product lines, and compared next-day forecasts with a simple alternative: reuse the order count from seven days earlier. The combined model reduces MAE from 11.56 to 9.64 orders per day on the same 112-day test period.

Model Choices Were Fixed Before the Final Test

01

Build the daily target

Audit 1,067,371 product lines and retain 1,003,214 positive paid lines. Count distinct UK orders for the forecast target. Every exclusion is recorded.

02

Select on earlier periods

Use three 28-day validation folds from 23 May to 14 August 2011. Select model settings and the 80% Random Forest / 10% XGBoost / 10% Ridge weights here.

03

Evaluate next-day predictions

Hold out 15 August–4 December 2011. Each forecast uses information available after the previous day. Preprocessing is fitted on training data.

Validation-fold results · Model and evaluation choices

Where the Forecast Improves, and Where It Falls Short

Compare errors.
Inspect the evidence.

01 / THE FORECASTNext-day orders

Daily Forecasts Compared with Observed Orders

The two lines show the recorded daily order count and the next-day prediction. Inspect a date to see its absolute error; switch to the full test to check whether the final four weeks hide earlier misses.

ObservedForecast

Daily order forecast

Hover, tap, or use the arrow keys to inspect a day. View source
02 / MODEL COMPARISONLower is better

Combining Models Improves Forecast Accuracy

Mean absolute error (MAE) measures the average size of daily forecast errors. The combined model records the lowest MAE among the approaches evaluated on this test set.

Forecasting approach comparison

The combined model achieves the lowest MAE at 9.64 orders per day, reducing forecasting error by 16.6% compared with the baseline.

The 16.6% reduction uses unrounded MAE values. WAPE is 15.76%; R² is 0.844. Ridge has slightly higher R² (0.845), while the ensemble has lower MAE. R² is regression fit, not prediction accuracy. View source
03 / ERROR BY WEEKDAYMAE · orders/day

Average Improvement Does Not Mean Every Day Improves

The ensemble reduces error on five of seven weekdays. Thursday and Saturday still favor the baseline, which helps identify where a single average hides weaker performance.

BaselineCombined model

Thursday remains a useful review target: MAE is 11.02 orders for the ensemble versus 10.56 for the baseline, on the weekday with the highest observed average demand.

16 test observations per weekday. Saturday has no retained paid orders; its baseline error is zero. Scores by weekday
04 / EXPLAINING THE MODELSHAP

Recent Order History and Calendar Patterns Drive the Forecast

The Saturday indicator and the previous seven-day average have the largest average SHAP contributions. These signals describe how the model uses the retailer’s historical order pattern; they do not establish what causes demand.

Forecast drivers

Bars measure average absolute contribution in orders. A separate additivity audit checks that weighted SHAP contributions reconstruct ensemble predictions, with any nonnegative correction recorded. View source
Additional research: product demand, sentiment and pricing

Different Targets Require Separate Conclusions

01

Product-level demand

On 12 real SKUs, the ensemble MAE is 390.17 units versus 304.61 for the rolling-mean baseline. The simpler baseline remains stronger for this task.

02

Controlled demand dataset

A separate 36-series, 3,744-row generated dataset records MAE 30.75 units, WAPE 6.37% and R² 0.936 for the selected ensemble. Pure Ridge has lower test MAE. These results are not combined with the UCI daily-order evaluation.

03

Sentiment and pricing

On 650 generated bilingual texts, accuracy falls from 89.2% on a random split to 29.3% on unseen template families. A separate 800-unit pricing experiment tests an 8% discount; it does not establish a margin increase.

Additional analyses and report links

From Raw Transactions to Reproducible Forecasts

I built reusable Python modules, DuckDB analyses, chronological backtesting and SHAP reporting. Automated checks cover distinct-order counting, future-target invariance, model selection and report generation. Source hashes, package versions and predictions make the results traceable. The next step is prospective evaluation on new data; staffing savings have not been measured.

Explore on GitHub

Reviewed 22 October 2026 against the project README and linked evaluation reports. Figures describe the documented dataset or test run.

BEHIND THE EXECUTIVE SUMMARY

Technical details