← Back to Home
ASSOCIATION RULES • CASE STUDY

Market Basket Analysis & Product Bundling Strategy

Role: Data Analyst (Personal Analytics Project) Timeline: Aug – Sep 2026 Stack: Python 3.x, mlxtend (Apriori), TransactionEncoder, Pandas, NumPy, Seaborn Scope: 51,290 Line-Items across 25,728 Distinct Order Baskets

1. Dataset, Scope & Business Context

Project Type Personal Project / Simulated Business Case
Dataset Source Simulated E-Commerce CSVs (EcomSales, Product)
Scale & Deduplication 51,290 line-items grouped into 25,728 unique OrderID baskets
Time Range & Currency Jan 2020 – Dec 2023 (4 Years) • Simulated USD ($)

To explore opportunities for increasing Average Order Value (AOV), this analysis replaces generic cross-selling assumptions with Apriori association rule mining across deduplicated order baskets.

  • Perform Exploratory Data Analysis (EDA) on basket size distributions and top-moving categories.
  • Apply the Apriori Algorithm to compute Support, Confidence, and Lift for co-occurring product combinations.
  • Identify cohesive "Shopping Ecosystems" to engineer high-margin product bundles (e.g., Weekend Reset Kit).
Methodological Scope & Caveats: Baskets are grouped by distinct OrderID (25,728 unique orders) with duplicate Subcategory entries removed per basket via .unique(). Mining used min_support = 0.005 (≥129 co-occurring orders), min_threshold = 0.1 (confidence), and lift > 1.2. Note that EcomSales.csv has no refund/cancellation column and association rules measure co-occurrence, not causal revenue lift.

2. Key Findings & Behavioral Affinity Rules

  • Highest Lift Linkage:
    [Candles, Room Sprays, Face Masks] → [Nail Care, Bath Oils/Bombs]
    • Lift: 4.25 (Customers purchasing the antecedent set are 4.25x more likely to co-purchase the consequent set compared to random baseline).
    • Confidence: 45% of baskets containing Candles, Room Sprays, and Face Masks also include Nail Care or Bath Oils/Bombs within the same OrderID.
  • Shopping Ecosystem A ("Home Spa"): A self-care basket containing Candles + Face Masks + Bath Oils + Nail Care purchased to simulate an at-home spa experience.
  • Shopping Ecosystem B ("Beauty from Within"): A wellness-driven basket combining Vitamins/Supplements + Hand Creams + Face Care, representing a disciplined health-conscious demographic.

3. Methodology & Analysis Fixes

  • Out-of-Memory (OOM) Prevention via Support Tuning: Initial min_support of 0.001 (0.1%) generated millions of combinatorial itemsets, crashing kernel RAM. Recalibrated threshold to 0.005 (0.5%) to maintain compute stability without losing high-lift rules.
  • In-Basket Deduplication: Refactored raw item aggregation using .unique(), eliminating repeated subcategories within a single OrderID prior to TransactionEncoder processing.
  • Pre-Algorithmic EDA Pipeline: Engineered exploratory subplots visualizing top-10 category velocity and basket-size distributions before model execution.

4. Proposed Commercial Experiments

  • Bundle Pilot ("Weekend Reset Kit"): Test packaging Ecosystem A items with a 10% bundle discount against standalone pricing to evaluate net AOV lift vs. margin dilution.
  • Dynamic Checkout Cross-Selling: When a user adds Candles to cart, test triggering a complementary prompt for Bath Bombs instead of competing candle brands.
  • Content Marketing Alignment: Test short-form campaign creatives around the 4-item Ecosystem A self-care routine.
Validation Plan: Because bundle discounts impact unit margin, validate via a 50/50 checkout A/B test measuring Incremental Gross Profit per Order, Basket Attach Rate, and AOV Lift.