In market basket analysis, support measures how often an itemset occurs across all transactions. For a rule P → Q, count transactions containing every item in both P and Q, then divide by the total number of transactions. Support describes frequency, not whether purchasing P makes Q more likely. section 4.3.1 section 4.11
Count complete baskets
Five invoices record whether milk, eggs, bread, and cheese were purchased. The rule {milk, eggs} → {bread} has support 2/5 = 0.4 because two invoices contain all three items. For {bread, eggs} → {cheese}, only one invoice contains all three, so support is 1/5 = 0.2. section 4.3.1
Table 4.2 Dataset to understand the concept of support, confidence, lift, and conviction
|
Invoice Number
|
Milk
|
Eggs
|
Bread
|
Cheese
|
|---|---|---|---|---|
|
1001
|
1
|
1
|
1
|
0
|
|
1002
|
0
|
1
|
1
|
1
|
|
1003
|
1
|
1
|
1
|
0
|
|
1004
|
0
|
1
|
0
|
1
|
|
1005
|
0
|
1
|
1
|
0
|
Use the 1s in each invoice row to verify which transactions contain every item in a rule. section 4.3.1
A minimum-support threshold keeps infrequent combinations out of consideration. Apriori examines item combinations across levels; on large datasets, generating candidates and repeatedly scanning transactions can be costly. In the five-invoice example, the pair {eggs, bread} has support 4/5 = 0.8, while {milk, bread} has 2/5 = 0.4. At a 0.5 threshold, only the first pair qualifies among the listed pairs. section 4.4 section 4.4.2
For a Python workflow, inspect the CSV before modeling: an initial load may mistake the first transaction for a header. Reload with `header=None`, convert transactions to a list of lists, and pass `min_support` to `apyori.apriori`. Check the resulting rule count alongside confidence and lift rather than treating support alone as proof that a rule is useful. With `pyECLAT`, fitting with `min_support=0.02` returns support values for items and combinations. section 4.4.1 section 4.5.1
