An end-to-end retail commercial intelligence system. This toolkit processes high-volume transactional logs, profiles granular consumer cohorts, and evaluates experimental regional layout optimizations through statistical control matching.
Supermarket category managers require data-driven guardrails to confirm whether floor layout changes yield valid commercial growth or capture random seasonal noise. This repository addresses this objective in a two-stage analytics pipeline:
- Customer Segmentation & Affinity Engine: Identifies high-value buyer cohorts and computes affinity indexing across packet dimensions and brand distributions.
- Experimental Store Trial Evaluator: Programmatically matches experimental locations with baseline locations using optimized distance and correlation scoring, checking sales performance via localized hypothesis testing.
Processes unstructured raw logs to map strategic consumer metrics across demographic dimensions (LIFESTAGE and PREMIUM_CUSTOMER).
- Data Hygiene Filters: Isolates text-based product anomalies (e.g., separating non-chip lines like dipping salsas) and eliminates structural anomalies like industrial wholesale purchases.
- Affinity Matrix Indexing: To pinpoint growth opportunities, product selections are evaluated against a baseline cohort via relative affinity scoring:
An affinity threshold greater than
Evaluates physical retail store tests implemented in target branches (77, 86, and 88) relative to un-modified control locations over a multi-month trial window.
-
Control Store Selector: Instead of relying on manual matching, control locations are selected using a compound score weighting a Pearson Product-Moment Correlation against a Min-Max Normalized Magnitude Distance across historical pre-trial sales (
$totSales$ ) and customer traffic volumes ($nCustomers$ ). -
Statistical Uplift Verification: Applies a variance-scaled tracking model over the trial period. The engine estimates variance within the pre-trial baseline period and flags trial deviations via a modified Welch's
$t$ -statistic comparison:
Significant store layouts are categorized by bounding deviations against a
Ensure Python 3.9+ is available on your local instance. Install dependencies via pip:
pip install -r requirements.txt