Customer Decision Hierarchy
Customer Decision Hierarchy Analysis for Product Substitutability and Range Optimization.
Business Context
Customer Decision Hierarchy (CDH) analysis reveals how customers perceive products as substitutes or complements. This critical intelligence informs range planning, assortment optimization, and delisting decisions by understanding which products customers view as interchangeable versus essential variety.
The Business Problem
Retailers often struggle with range rationalization decisions: - Which products can be delisted without losing customers? - When does variety add value versus create confusion? - Which products are true substitutes in customers' minds? - How to optimize shelf space without sacrificing choice?
CDH analysis answers these questions by analyzing actual switching behavior rather than relying on product attributes or manager intuition.
How It Works
The analysis examines customer purchase patterns to identify substitutability: - Products rarely bought by the same customer → likely substitutes - Products often bought by the same customer → complements or variety-seeking - Uses Yule's Q coefficient to measure substitutability strength - Creates hierarchical clusters showing substitution relationships
Real-World Applications
- Range Rationalization
- Identify safe delisting candidates within substitute clusters
- Maintain one option per cluster to preserve choice
-
Reduce SKU count while maintaining customer satisfaction
-
New Product Introduction
- Understand which existing products new items might cannibalize
- Position new products to fill gaps rather than duplicate
-
Predict source of volume for new launches
-
Private Label Strategy
- Identify national brand products suitable for PL alternatives
- Understand where PL can substitute vs. complement
-
Optimize PL/NB mix within categories
-
Space Optimization
- Allocate more space to non-substitutable products
- Reduce facings for products within same substitute cluster
-
Optimize variety/productivity trade-off
-
Markdown Strategy
- Clear substitute products sequentially, not simultaneously
- Understand which products can drive category traffic
- Identify products that won't cannibalize when promoted
Business Value
- Efficient Assortment: Reduce complexity without losing sales
- Better Space Productivity: Allocate space based on true variety value
- Improved Margins: Replace duplicative SKUs with unique offerings
- Customer Satisfaction: Maintain perceived choice while reducing confusion
- Strategic Clarity: Data-driven approach to range decisions
CustomerDecisionHierarchy
Analyzes product substitutability patterns to optimize retail assortments.
The CustomerDecisionHierarchy class identifies which products customers view as substitutes versus essential variety. This enables data-driven range planning decisions that maintain customer choice while improving operational efficiency.
Business Insight
Traditional range planning often assumes products in the same category are substitutes (e.g., all yogurts are interchangeable). However, customer behavior reveals the truth: some customers always buy both Greek and regular yogurt (complements), while others switch between strawberry and raspberry flavors (substitutes).
Substitutability Logic
The analysis identifies substitutes through purchase patterns: - High substitutability: Customers buy product A OR product B, rarely both - Low substitutability: Customers often buy both A AND B - Exclusion logic: Products bought in same transaction can't be substitutes
Decision Framework
The hierarchy output guides range decisions: - Tight clusters: Strong substitutes - keep best performer - Loose clusters: Weak substitutes - maintain variety - Separate branches: Different needs - preserve both - Isolated products: Unique value - protect from delisting
Example Use Case
A supermarket analyzing yogurt finds: - Cluster 1: Store brand vanilla, strawberry, raspberry (substitutes) - Cluster 2: Greek plain, Greek honey (substitutes) - Separate branch: Kids' squeezable yogurt (unique need)
Decision: Can reduce flavor variety in Cluster 1, maintain Greek options, must keep kids' yogurt despite low sales.
Source code in pyretailscience/analysis/customer_decision_hierarchy.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
__init__(df, product_col, exclude_same_transaction_products=True, method='yules_q', random_state=42)
Initialize customer decision hierarchy analysis for range optimization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df |
DataFrame
|
Transaction data with customer purchase history. Must contain: customer_id, transaction_id, and product identifier. |
required |
product_col |
str
|
Column containing products to analyze for substitutability (e.g., "product_name", "sku", "brand", "subcategory"). |
required |
exclude_same_transaction_products |
bool
|
Whether products bought together in one transaction should be considered non-substitutes. True = If customer buys milk and eggs together, they're not substitutes. False = Include all purchase patterns. Defaults to True (recommended for most retail contexts). |
True
|
method |
Literal['yules_q']
|
Statistical method for measuring substitutability. "yules_q" measures association strength between binary purchase patterns. Defaults to "yules_q". |
'yules_q'
|
random_state |
int
|
Seed for reproducible clustering results. Important for consistent range planning decisions. Defaults to 42. |
42
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If required columns are missing from the dataframe. |
Business Example
Analyze substitutability in coffee category
cdh = CustomerDecisionHierarchy( ... df=transactions, ... product_col="brand_flavor", # e.g., "Folgers_Original" ... exclude_same_transaction_products=True # Bought together = not substitutes ... )
Use results to identify which coffee SKUs can be delisted
Source code in pyretailscience/analysis/customer_decision_hierarchy.py
plot(title='Customer Decision Hierarchy', x_label=None, y_label=None, ax=None, figsize=None, source_text=None, **kwargs)
Plots the customer decision hierarchy dendrogram.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title |
str
|
The title of the plot. Defaults to None. |
'Customer Decision Hierarchy'
|
x_label |
str
|
The label for the x-axis. Defaults to None. |
None
|
y_label |
str
|
The label for the y-axis. Defaults to None. |
None
|
ax |
Axes
|
The matplotlib Axes object to plot on. Defaults to None. |
None
|
figsize |
tuple[int, int]
|
The figure size. Defaults to None. |
None
|
source_text |
str
|
The source text to annotate on the plot. Defaults to None. |
None
|
**kwargs |
dict[str, any]
|
Additional keyword arguments to pass to the dendrogram function. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
SubplotBase |
SubplotBase
|
The matplotlib SubplotBase object. |