Association Rules, and What Confidence Leaves Out

How support, confidence and lift are computed from transaction counts, why the anti-monotone property lets a level-wise search examine a fraction of the candidate lattice, and the case that matters most: a rule whose confidence passes any conventional threshold while its lift falls below one, so the consequent is less frequent among transactions containing the antecedent than it is overall, which is the opposite of what the confidence figure suggests.

Definition

Transaction data is a collection of sets. Each transaction lists the items that occurred together, with no order and no quantities.

An itemset is any set of items. Its support is the fraction of transactions containing it:

supp ⁡ ( I ) = | { t : I ⊆ t } | n .

An association rule A → B , with A and B disjoint itemsets, is scored by three quantities:

supp ⁡ ( A → B ) = supp ⁡ ( A ∪ B ) , conf ⁡ ( A → B ) = supp ⁡ ( A ∪ B ) supp ⁡ ( A ) , lift ⁡ ( A → B ) = conf ⁡ ( A → B ) supp ⁡ ( B ) .

Support says how often the combination occurs at all. Confidence says how often B follows given A . Lift compares that against how often B occurs regardless, so lift = 1 means A and B co-occur exactly as independence predicts, above one means more often, and below one means less often.

The anti-monotone property. If I ⊆ J then supp ⁡ ( J ) ≤ supp ⁡ ( I ) , because every transaction containing J contains I . So no superset of an infrequent itemset can be frequent.

Apriori uses this to search level by level: count the support of single items, discard the infrequent, form candidate pairs only from survivors, and continue. Whole branches of the lattice are never examined, because one infrequent subset rules out everything above it.

What the procedure does not supply. The support threshold is an input, not a finding; rules below it are never generated, whatever their lift. And the search is exhaustive within the threshold, so it returns every qualifying rule rather than the interesting ones, selecting among them is the analyst's work.

Assumptions and scope

  • Support and confidence are computed from counts of transactions, not of items. A transaction containing an item twice counts once, and quantities are outside the model.

  • The support threshold determines what is generated. A rule below it is never produced, however strong its lift would have been, so a rare but genuine pattern is invisible to a search tuned for common ones.

  • Lift equals one under independence and is symmetric in the two itemsets. Confidence is not symmetric, so a rule and its converse share a lift and generally differ in confidence.

  • Lift is a comparison against independence within this transaction set. It supports no causal claim: two items may co-occur because one drives the other, because both follow a third, or because of how the transactions were collected.

  • A high confidence computed from very few transactions is weak evidence. A rule holding in 2 of 10 transactions and one holding in 200 of 1000 have the same support, 0.2 , and the same confidence; what differs is the number of transactions behind the estimate and therefore its sampling uncertainty. Support is a proportion and does not record it. Reporting the raw counts, or an interval for the rule measure, is what separates the two cases.

  • The figures in this unit come from exact rational arithmetic on the stated ten-transaction set, with the Apriori candidate counts obtained by running the level-wise search and comparing against the full 2 5 − 1 lattice.

Worked material

Example

Every two-item rule, ranked by confidence

All twenty directed rules between pairs of items in the unit's ten transactions, ordered by confidence, which is how a mining tool would present them by default.

rulesupportconfidencelift
butter → milk 0.2000 1.0000 1.250000
butter → bread 0.2000 1.0000 1.250000
jam → milk 0.1000 1.0000 1.250000
jam → bread 0.1000 1.0000 1.250000
milk → bread 0.7000 0.8750 1.093750
bread → milk 0.7000 0.8750 1.093750
eggs → milk 0.4000 0.6667 0.833333
eggs → bread 0.4000 0.6667 0.833333
milk → eggs 0.4000 0.5000 0.833333
bread → eggs 0.4000 0.5000 0.833333
butter → eggs 0.1000 0.5000 0.833333
milk → butter 0.2000 0.2500 1.250000
bread → butter 0.2000 0.2500 1.250000
eggs → butter 0.1000 0.1667 0.833333
milk → jam 0.1000 0.1250 1.250000
bread → jam 0.1000 0.1250 1.250000

(The four rules pairing jam with eggs or butter have support 0 and are omitted.)

The top four rules have perfect confidence and rest on two transactions and one transaction respectively. The most trustworthy rules in the table, bread and milk, on seven transactions, sit fifth and sixth. Sorting by confidence puts the flimsiest evidence at the top.

Five rules pass a 0.5 confidence threshold with lift below one. Every rule involving eggs with bread or milk has lift 0.833333 , and three of them clear a conventional confidence bar. A pipeline filtering on confidence alone would surface all three as findings, each describing an association that runs the opposite way.

The symmetry is visible. Each lift value appears in both directions of its pair: bread → eggs and eggs → bread both show 0.833333 while their confidences are 0.5000 and 0.6667 . Milk and bread both show 1.093750 and, because the two items have identical support, identical confidences of 0.8750 . A coincidence of this data, not a rule.

Only two distinct lifts appear, 1.250000 and 0.833333 , plus 1.093750 for the bread–milk pair. That is an artefact of a tiny dataset with few distinct support values, and it should be read as such rather than as structure.

---

Confidence ranks rules by how common the consequent is, mostly. Lift separates them into those occurring more often than chance and those occurring less. Support says how much data stands behind either verdict. Three columns, three different questions, and a tool presenting only the second column, sorted, would mislead on all of them.

Contrast

Pairs that differ in one respect

Two rules with comparable confidence and opposite verdicts.

bread → milkbread → eggs
support 0.7000 0.4000
confidence 0.8750 0.5000
consequent's own support 0.8000 0.6000
lift 1.093750 0.833333
verdictoccurs more than chanceoccurs less than chance

Both confidences are respectable. The column that decides is the third, and neither confidence contains it. This is the single comparison worth taking from the unit: a confidence is only interpretable beside the consequent's base rate.

A rule against its converse.

bread → eggs has confidence 0.5000 ; eggs → bread has 0.6667 . Same four transactions, same co-occurrence, different denominators, 0.8000 against 0.6000 . The lift is 0.833333 for both.

So the question "are bread and eggs associated" has one answer, and the question "given bread, expect eggs" has a different answer from "given eggs, expect bread". Choosing the measure means choosing which question is being asked.

Perfect confidence on two transactions against modest confidence on seven.

butter → milk scores confidence 1.0000 and lift 1.250000 , resting on two transactions. bread → milk scores 0.8750 and 1.093750 , resting on seven. The first ranks higher on both measures and is far weaker evidence: one butter purchase without milk would take its confidence to 0.6667 , while one bread purchase without milk barely moves the second.

Support is the column that separates them, which is why it is reported rather than used only as a filter.

A pruned branch against an examined one.

Butter has support 0.2000 , below the 0.3 threshold, so every itemset containing butter is eliminated by that one measurement, provably, not probably. Bread has support 0.8000 , so every pair containing bread is a live candidate and must be counted.

One measurement settles a whole branch; another opens one. The asymmetry is what makes the search affordable, and it rests on support never rising as a set grows.

Exhaustive search against a selective one.

Apriori returns every rule above the thresholds, all of them, guaranteed complete. That completeness is a strength for the search and a burden afterwards: on real data it produces thousands of true statements, and nothing in the procedure ranks them by interest. A method returning fewer, better rules would be making judgements the algorithm has no basis for making.

Lift above one against a cause.

A lift of 1.093750 says two items co-occur about nine percent more often than independence predicts, in this transaction set. It does not say that buying one leads to buying the other, that a shared cause drives both, or that the pattern will hold next month. Those are separate claims, and every one of them needs evidence the transaction counts do not contain.

Common errors

Common misconception

That a rule with high confidence has found an association, so a threshold on confidence is enough to filter mined rules. Confidence is the proportion of transactions containing the antecedent that also contain the consequent, and it takes no account of how common the consequent already is. On the ten-transaction set of this unit, bread → eggs has confidence 1 / 2 = 0.5000 , which passes most conventional thresholds, yet eggs appear in 3 / 5 = 0.6000 of all transactions. Among transactions containing bread, eggs appear less often than among transactions generally, and the lift makes that precise: 0.5000 / 0.6000 = 5 / 6 = 0.833333 , below one. The rule is real as a frequency and describes a negative association, so acting on it, placing eggs beside bread to encourage the pairing, would be acting against the evidence. A confidence threshold cannot detect this, because the quantity it thresholds does not contain the consequent's base rate. Comparing against that base rate is what lift does, and it is why lift rather than confidence decides whether a rule says anything.

Common misconception

That A → B and B → A are the same rule reported two ways, so establishing one establishes the other. Confidence is directional: it divides the support of the pair by the support of the antecedent alone, and the two antecedents differ. On the transaction set of this unit, bread → eggs has confidence 0.4000 / 0.8000 = 0.5000 while eggs → bread has confidence 0.4000 / 0.6000 = 0.6667 . The same co-occurrence, two different numbers, because bread is the more common item. Lift, by contrast, divides the same pair support by the product of both individual supports, so it is symmetric: both directions give 0.833333 . This is why the two measures answer different questions. Confidence answers "given this antecedent, how often does the consequent follow", which is what a recommendation or a shelf placement needs and which depends on which item is the trigger. Lift answers "do these items occur together more or less often than independence predicts", which is a property of the pair and carries no direction at all. Reporting a directional confidence as though it described the pair, or a symmetric lift as though it justified one direction of intervention, mismatches the measure to the claim.

Related units

Requires

Connected

Learn this topic

Used in

Sources

Results update as you type. Use the up and down arrow keys to move between results, Enter to open one, and Escape to close.

Type to search.

Settings

Appearance

Interface density

Your record

Your progress is stored in this browser and nowhere else: an identifier, the answers you have given, the mastery states and review schedule derived from them, and the lesson you last opened. Clearing it makes you a new learner on this device. It cannot be undone, and it will not affect your appearance or density settings.

Focus timer

Focus--minutes remaining

Phase

Kept in this browser only, and used to label the session in your own history.

Today

Nothing recorded yet. Finish a focus session and it will appear here.

Settings

Focus sessions between long breaks.

Sessions you are aiming for in a day.

Notifications

Your history

Sessions are stored in this browser and nowhere else. They are not evidence and never reach your mastery record.