business analytics
slug: step-basketPerforms market basket analysis (association rule mining) on transaction data to identify which items are frequently purchased together. Discovers meaningful relationships between products to inform cross-selling strategies, product placement, and customer behavior insights.
transactionId (string) - Column name containing transaction identifiers (default: transactionId)itemColumn (string) - Column name containing item identifiers (default: item)minSupport (float) - Minimum support threshold (0-1), percentage of transactions containing the itemset (default: 0.01)minConfidence (float) - Minimum confidence threshold (0-1), probability of consequent given antecedent (default: 0.5)minLift (float) - Minimum lift threshold, measure of rule strength beyond random chance (default: 1.0)maxItemsetSize (int) - Maximum number of items in a rule (default: 3)antecedent - Item or items purchased (the "if" part of the rule)consequent - Item likely to be purchased with the antecedent (the "then" part)support - Percentage of transactions containing both antecedent and consequentconfidence - Probability of consequent given antecedentlift - Strength of association beyond random chance (>1 indicates positive association)count - Number of transactions containing the entire ruleDetailed summary statistics stored in extras.basket:
totalTransactions - Number of transactions analyzeduniqueItems - Number of distinct items across all transactionsavgItemsPerTransaction - Average basket sizetotalRules - Number of association rules discoveredmaxLift - Maximum lift value foundavgConfidence - Average confidence across all rulesparameters - Copy of the parameters used for analysisbasket:
transactionId: order_id
itemColumn: product_name
minSupport: 0.02
minConfidence: 0.3
minLift: 1.2
basket:
transactionId: ticket_number
itemColumn: menu_item
minSupport: 0.05
minConfidence: 0.4
minLift: 1.5
maxItemsetSize: 4
| order_id | product_name |
|---|---|
| 1001 | Bread |
| 1001 | Milk |
| 1001 | Eggs |
| 1002 | Milk |
| 1002 | Cereal |
| 1003 | Bread |
| 1003 | Butter |
| 1003 | Jam |
| 1004 | Bread |
| 1004 | Milk |
| 1004 | Butter |
| antecedent | consequent | support | confidence | lift | count |
|---|---|---|---|---|---|
| Milk | Bread | 0.50 | 0.67 | 1.33 | 2 |
| Butter | Bread | 0.50 | 1.00 | 2.00 | 2 |
| Bread | Milk | 0.50 | 0.67 | 1.33 | 2 |
| Bread, Butter | Milk | 0.25 | 0.50 | 1.00 | 1 |
| Milk, Bread | Butter | 0.25 | 0.50 | 1.00 | 1 |
minSupport if too many rules are generatedminConfidence if too few rules are foundminLift to focus on stronger associationsmaxItemsetSize to discover more complex patterns