Support and Confidence in Data Mining
Support and confidence — along with lift, leverage, and conviction — are covered together with a full worked example in the lesson on association rule mining, so this lesson does not re-derive the two formulas from scratch. Instead, it uses one clean pair of examples to make explicit a property of confidence that's easy to miss when support and confidence are only ever introduced side by side as if they behaved the same way: support is symmetric, but confidence is not.
Support Is Symmetric
For any two items A and B, the support of the itemset {A, B} is the same regardless of which item you name first — Support(A ∩ B) and Support(B ∩ A) describe the identical set of transactions, so they are always equal by definition. Support answers "how often do these items appear together," and togetherness doesn't have a direction.
Confidence Is Not Symmetric
Confidence answers a different, directional question: "given that A was bought, how often was B also bought?" That "given" is exactly what breaks the symmetry, because it divides by the support of the item on the left side of the rule — and Support(A) and Support(B) are generally not equal to each other. Take four transactions:
T1: Shoes, Socks, Bag, Perfume
T2: Shoes, Socks, Perfume, Watch
T3: Bag, Perfume, Watch, Socks
T4: Socks, Necktie, Watch
Socks appears in every transaction; Shoes appears in only two:
Support(Shoes) = 2 / 4 = 0.50
Support(Socks) = 4 / 4 = 1.00
Support(Shoes ∩ Socks) = 2 / 4 = 0.50 (T1 and T2 — the same 0.50 either way you name the pair)
Confidence(Shoes ⇒ Socks) = Support(Shoes ∩ Socks) / Support(Shoes) = 0.50 / 0.50 = 1.00 (100%)
Confidence(Socks ⇒ Shoes) = Support(Shoes ∩ Socks) / Support(Socks) = 0.50 / 1.00 = 0.50 (50%)
The same pair of items, the same underlying co-occurrence, produces two completely different confidence values depending on which item is treated as the condition and which as the result. Confidence(Shoes ⇒ Socks) = 100% because everyone who buys shoes also buys socks in this data; Confidence(Socks ⇒ Shoes) = 50% because socks are bought far more broadly, by people who have no particular interest in shoes at all.
Why This Distinction Isn't Just a Technicality
This asymmetry has a direct, practical consequence for how association rules get used. If a retailer wants to know which product to recommend to shoe buyers, Confidence(Shoes ⇒ Socks) = 100% is exactly the right number to act on. But if the retailer instead used Confidence(Socks ⇒ Shoes) = 50% to decide whether recommending shoes to sock buyers is worthwhile, they'd be relying on a number that reflects how common socks are overall almost as much as it reflects any real connection to shoes — a general-purpose item like socks will show unremarkable confidence pointing toward almost anything, precisely because its own support is so high that the denominator in the confidence formula does most of the work. This is exactly why the lesson on association rule mining introduces lift, which divides confidence by the target item's own support and corrects for this — a step neither support nor confidence take on their own.
Where the Full Picture Is Covered
Beyond this asymmetry, the complete treatment of support, confidence, lift, leverage, and conviction — including how each one is computed and what each protects against — is covered with a full worked dataset in the lesson on association rule mining, and the Apriori algorithm that uses minimum support and minimum confidence thresholds to generate rules at scale is covered in the same lesson.