Skip to content

ysf-sheikh/commercial-data-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Retail Strategy & Category Performance Analytics Engine

Quantium Data Analytics Simulation

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.


Strategic Overview

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:

  1. Customer Segmentation & Affinity Engine: Identifies high-value buyer cohorts and computes affinity indexing across packet dimensions and brand distributions.
  2. Experimental Store Trial Evaluator: Programmatically matches experimental locations with baseline locations using optimized distance and correlation scoring, checking sales performance via localized hypothesis testing.

Architecture & Implementation Details

Module 1: Customer Cohort Segmentation (customer_behavior_analysis.py)

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:

$$\text{Affinity Index} = \frac{% \text{ of Target Cohort Purchases for Feature}}{% \text{ of Baseline Cohort Purchases for Feature}}$$

An affinity threshold greater than $1.0$ indicates an over-indexing preference, providing a clear mathematical signal for floor displays or tailored package bundles.

Cohort Insights Visualizations:

customer_counts_by_segment sales_by_segment transactions_over_time

Module 2: A/B Trial Layout Evaluation (segment_performance_evaluation.py)

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:

$$t = \frac{\text{Percentage Difference}_{\text{Trial}} - \text{Mean}(\text{Percentage Difference}_{\text{Pre-Trial}})}{\text{Standard Deviation}(\text{Percentage Difference}_{\text{Pre-Trial}})}$$

Significant store layouts are categorized by bounding deviations against a $95%$ statistical confidence threshold.

A/B Performance Visualizations:

trial_assessment_77_nCustomers trial_assessment_77_totSales trial_assessment_86_nCustomers trial_assessment_86_totSales trial_assessment_88_nCustomers trial_assessment_88_totSales

Installation

Ensure Python 3.9+ is available on your local instance. Install dependencies via pip:

pip install -r requirements.txt

Certification

Quantium Data Analysis

About

An end-to-end retail analytics engine. Implements customer lifestyle segmentation, brand/pack-size product affinity indexes, and a statistical control-store matching engine with t-test sales uplift verification for layout trials.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages