1. Gyanastra
  2. Database Systems
  3. UGC NET: Data Mining
  4. Association Rules
Free lesson, no account needed 9 min read 12 practice questions after it
Asked in past papers3 times
  • UGC NET201620072006

Database Systems · UGC NET: Data Mining

Association Rules

Overview

Association rule mining discovers items or events that occur together frequently in a transactional database. Its classic application is market-basket analysis: finding products that customers buy together.
It is an unsupervised, descriptive data-mining task because no class label is used while mining.
In UGC NET, this topic is asked through definitions, support-confidence-lift numericals, Apriori candidate generation, FP-growth, closed/maximal itemsets, and statement/match-list questions.
Before studying it, know basic set notation, transaction tables, fractions, and the idea of conditional probability.

Key concepts

  • Convention used here: items in an itemset are written in lexicographic order; a rule is X⇒YX \Rightarrow Y with non-empty disjoint itemsets XX and YY; support is a fraction unless called support count.
  • A transaction database DD has N=∣D∣N=|D| transactions; each transaction is a subset of the item universe II. An itemset is any subset of II; a k-itemset has kk items.
  • Support count σ(X)\sigma(X) is the number of transactions containing itemset XX. Support is σ(X)/N\sigma(X)/N. An itemset is frequent if its support is at least the user-given minimum support minsupminsup.
  • An association rule X⇒YX \Rightarrow Y states co-occurrence, not causality. Its support is the support of X∪YX \cup Y; its confidence is the conditional frequency of YY among transactions containing XX.
  • Minimum confidence minconfminconf filters rules after frequent itemsets are found. A rule is strong if it satisfies both minsupminsup and minconfminconf.
  • Apriori property: every non-empty subset of a frequent itemset is frequent; equivalently, every superset of an infrequent itemset is infrequent. This is the anti-monotonicity of support.
  • Candidate generation: from frequent (k−1)(k-1)-itemsets Lk−1L_{k-1}, join pairs that share the first k−2k-2 items; then prune a candidate if any of its (k−1)(k-1)-subsets is not in Lk−1L_{k-1}.
  • Rule generation: for a frequent itemset LL, form rules (L−S)⇒S(L-S) \Rightarrow S, where SS is a non-empty proper subset of LL.
    If a rule with consequent SS fails minconfminconf, then for the same LL, every rule with a superset of SS as consequent also fails; smaller consequents must still be checked.
  • FP-growth uses an FP-tree and a header table. It scans the database twice, avoids candidate generation, and mines frequent itemsets through conditional pattern bases and conditional FP-trees.
  • Closed frequent itemset: frequent itemset with no proper superset having the same support. Maximal frequent itemset: frequent itemset with no frequent proper superset.
    Every maximal frequent itemset is closed, but a closed itemset need not be maximal.
  • Lift checks dependence. Lift=1\text{Lift}=1 means independence; Lift>1\text{Lift}>1 positive association; Lift<1\text{Lift}<1 negative association. High confidence alone can mislead if the consequent is already very frequent.
  • Eclat uses vertical transaction-id lists and intersections; CHARM mines closed itemsets. Association mining is used in cross-selling, link analysis, recommender systems, and market-basket analysis.
  • Apriori is not supervised; it does not use class labels. Classification is supervised, and clustering is unsupervised but groups objects rather than finding co-occurrence rules.

How it works

Apriori algorithm

  1. Scan DD, count every 1-itemset, and keep those with support at least minsupminsup as L1L_1.
  2. For k≥2k \ge 2, generate candidate kk-itemsets CkC_k by self-joining Lk−1L_{k-1}: join two (k−1)(k-1)-itemsets if their first k−2k-2 items are identical.
  3. Prune each candidate if any of its (k−1)(k-1)-subsets is absent from Lk−1L_{k-1}.
  4. Scan DD, count support of remaining candidates, and keep those meeting minsupminsup as LkL_k.
  5. Repeat until no new frequent itemsets are found.
  6. For each frequent itemset LL, generate rules (L−S)⇒S(L-S)\Rightarrow S and keep those meeting minconfminconf. Use the confidence pruning rule carefully: a failed large consequent does not eliminate a smaller consequent.

FP-growth algorithm

  1. Scan DD, count item supports, discard infrequent items, and sort frequent items in descending support order.
  2. Scan DD again and insert each transaction’s frequent items into an FP-tree in that order; shared prefixes share nodes, and counts increase.
  3. For each item in the header table, collect its conditional pattern base: the prefix paths ending at that item with their counts.
  4. Build a conditional FP-tree, removing items whose support falls below minsupminsup, and mine recursively.
  5. Output frequent itemsets; generate association rules and test confidence as in Apriori.
Figure. Notice the loop: Ck candidates are self-joined from Lk-1, pruned by infrequent subsets, counted on D, and kept as Lk until none remain; then rules are generated and confidence-tested.

Formulas

  • Let N=∣D∣N=|D|, and let σ(X)\sigma(X) be the number of transactions containing itemset XX.

  • support(X)=σ(X)N\text{support}(X)=\dfrac{\sigma(X)}{N}

  • support(X⇒Y)=support(X∪Y)=σ(X∪Y)N\text{support}(X \Rightarrow Y)=\text{support}(X \cup Y)=\dfrac{\sigma(X \cup Y)}{N}

  • confidence(X⇒Y)=σ(X∪Y)σ(X)=support(X∪Y)support(X)\text{confidence}(X \Rightarrow Y)=\dfrac{\sigma(X \cup Y)}{\sigma(X)}=\dfrac{\text{support}(X \cup Y)}{\text{support}(X)}

  • lift(X⇒Y)=support(X∪Y)support(X)support(Y)=confidence(X⇒Y)support(Y)\text{lift}(X \Rightarrow Y)=\dfrac{\text{support}(X \cup Y)}{\text{support}(X)\text{support}(Y)}=\dfrac{\text{confidence}(X \Rightarrow Y)}{\text{support}(Y)}

  • leverage(X⇒Y)=support(X∪Y)−support(X)support(Y)\text{leverage}(X \Rightarrow Y)=\text{support}(X \cup Y)-\text{support}(X)\text{support}(Y)

  • conviction(X⇒Y)=1−support(Y)1−confidence(X⇒Y)\text{conviction}(X \Rightarrow Y)=\dfrac{1-\text{support}(Y)}{1-\text{confidence}(X \Rightarrow Y)}

  • Frequent itemset condition: support(X)≥minsup\text{support}(X)\ge minsup.

  • Strong rule condition: support(X⇒Y)≥minsup\text{support}(X \Rightarrow Y)\ge minsup and confidence(X⇒Y)≥minconf\text{confidence}(X \Rightarrow Y)\ge minconf.

  • Apriori property: if X⊆YX \subseteq Y and XX is infrequent, then YY is infrequent; equivalently, if YY is frequent, every X⊂YX\subset Y is frequent.

  • For a fixed frequent itemset LL, if S⊂TS \subset T, then confidence(L−T⇒T)≤confidence(L−S⇒S)\text{confidence}(L-T \Rightarrow T)\le \text{confidence}(L-S \Rightarrow S). Thus larger consequents have no greater confidence.

  • A frequent nn-itemset can produce at most 2n−22^n-2 non-empty proper rules.

Worked examples

Example 1: support, confidence, lift. Five transactions are:

TransactionCustomerItems
T1RameshMilk, Bread, Butter
T2GeetaMilk, Bread
T3PinkiMilk, Butter
T4AnkurBread, Butter
T5SunitaMilk, Bread, Butter

Counts: Milk =4=4, Bread =4=4, Milk and Bread =3=3. For Milk ⇒\Rightarrow Bread:

  • Support =3/5=0.60=3/5=0.60.
  • Confidence =3/4=0.75=3/4=0.75.
  • Lift =0.60/[(4/5)(4/5)]=0.60/0.64=0.9375=0.60/[(4/5)(4/5)]=0.60/0.64=0.9375.
    Answer: support 0.600.60, confidence 0.750.75, lift 0.93750.9375. Since lift is below 1, the items are slightly negatively associated despite high confidence.

Example 2: Apriori candidate generation. Suppose L3={{A,B,C},{A,B,D},{A,C,D},{A,C,E},{B,C,D}}L_3=\{\{A,B,C\},\{A,B,D\},\{A,C,D\},\{A,C,E\},\{B,C,D\}\}. To form C4C_4, join L3L_3 pairs sharing the first two items:

  • {A,B,C}\{A,B,C\} and {A,B,D}\{A,B,D\} join to {A,B,C,D}\{A,B,C,D\}.
  • {A,C,D}\{A,C,D\} and {A,C,E}\{A,C,E\} join to {A,C,D,E}\{A,C,D,E\}.

Prune using 3-subsets:

  • {A,B,C,D}\{A,B,C,D\}: subsets ABC,ABD,ACD,BCDABC, ABD, ACD, BCD are all in L3L_3, so keep.
  • {A,C,D,E}\{A,C,D,E\}: subsets include ADEADE and CDECDE, not in L3L_3, so discard.

Answer: C4={{A,B,C,D}}C_4=\{\{A,B,C,D\}\}.

Example 3: rule confidence and pruning. For a frequent itemset L={A,B,C,D}L=\{A,B,C,D\}, let σ(ABCD)=20\sigma(ABCD)=20, σ(AB)=100\sigma(AB)=100, σ(ABC)=40\sigma(ABC)=40, σ(A)=200\sigma(A)=200. Let minconf=0.30minconf=0.30.

  • AB⇒CDAB \Rightarrow CD: confidence =20/100=0.20=20/100=0.20, fails.
  • ABC⇒DABC \Rightarrow D: confidence =20/40=0.50=20/40=0.50, passes.
  • A⇒BCDA \Rightarrow BCD: confidence =20/200=0.10=20/200=0.10, fails.

The failed rule AB⇒CDAB\Rightarrow CD tells us that any rule with a larger consequent, such as A⇒BCDA\Rightarrow BCD, also fails. It does not eliminate ABC⇒DABC\Rightarrow D, whose consequent is smaller. Answer: among these three, only ABC⇒DABC\Rightarrow D is strong.

Example 4: match-the-list. Match List-I with List-II.

List-IList-II
A. Confidence of X⇒YX\Rightarrow Yi. fraction of transactions containing both XX and YY
B. Lift of X⇒YX\Rightarrow Yii. confidence divided by support of YY
C. Support of X⇒YX\Rightarrow Yiii. σ(X∪Y)/σ(X)\sigma(X\cup Y)/\sigma(X)
D. Apriori propertyiv. every subset of a frequent itemset is frequent

Answer: A-iii, B-ii, C-i, D-iv.

Comparison

MeasureFormulaSymmetric?Main trap
Supportσ(X∪Y)/N\sigma(X\cup Y)/NYesNot support of XX plus support of YY
Confidenceσ(X∪Y)/σ(X)\sigma(X\cup Y)/\sigma(X)NoDenominator is antecedent support
Liftsupport(X∪Y)support(X)support(Y)\dfrac{\text{support}(X\cup Y)}{\text{support}(X)\text{support}(Y)}YesLift 1 means independence, not high confidence
Itemset typeDefinitionRelationship
Frequentsupport at least minsupminsupLargest collection
Closed frequentfrequent and no proper superset with same supportContains all maximal itemsets
Maximal frequentfrequent and no frequent proper supersetEvery maximal is closed
AprioriFP-growth
Generates candidate itemsetsAvoids candidate generation
Multiple database scansTwo database scans
Simple but costly at low supportUses FP-tree and conditional FP-trees
At very low support frequent itemsets increaseCan also become memory-heavy for large trees
AssociationClassificationClustering
UnsupervisedSupervisedUnsupervised
Finds co-occurrence rulesPredicts a discrete labelGroups similar objects
Example: cross-sellingExample: decision treeExample: k-means

Revision summary

  1. Support is a fraction of all transactions; support count is an integer.
  2. Rule support is support of X∪YX\cup Y, never support(X)+support(Y)\text{support}(X)+\text{support}(Y).
  3. Confidence denominator is support(X)\text{support}(X), the antecedent.
  4. Lift =1=1: independence; lift >1>1: positive association; lift <1<1: negative association.
  5. High confidence with a very frequent consequent can still be misleading; check lift.
  6. Apriori property: frequent itemset’s subsets are frequent; infrequent itemset’s supersets are infrequent.
  7. Apriori join uses Lk−1L_{k-1} pairs sharing the first k−2k-2 items.
  8. FP-growth scans the database twice and builds an FP-tree; it does not generate candidates.
  9. Low minsupminsup increases the number of frequent itemsets and usually makes Apriori costly.
  10. Maximal implies closed; closed does not imply maximal.
  11. Apriori is unsupervised; association mining is used for cross-selling and link analysis.
  12. A frequent nn-itemset has at most 2n−22^n-2 non-empty proper rules.

Previous-year exam insights

  • Direct questions ask definitions of support, confidence, lift, Apriori property, closed itemset, and maximal itemset.
  • Numeric questions give a transaction table and ask support, confidence, or lift; compute counts first, then fractions.
  • Statement I/II questions compare Apriori and FP-growth, low-support behaviour, and supervised versus unsupervised nature.
  • Candidate-generation questions give L3L_3 and ask for C4C_4; apply the join step, then prune using missing 3-subsets.
  • Match-list questions pair terms with formulas or roles: confidence, lift, support, Apriori property.
  • Trap: high confidence does not imply positive lift; confidence alone can be misleading.
  • Trap: at very low support the number of frequent itemsets becomes larger, not smaller; Apriori becomes expensive.
  • Trap: FP-growth avoids candidate generation, but it still scans the database twice and builds conditional trees.

Practice at PARIKSHA

You are ready for the PARIKSHA tests of this sub-topic when you can:

  • Define support, confidence, and lift and write their formulas without confusion.
  • Compute support count, support, confidence, and lift from a small transaction table.
  • State and apply the Apriori property in both directions.
  • Generate CkC_k from Lk−1L_{k-1} using the join step and prune invalid candidates.
  • Explain why FP-growth avoids candidate generation and list its two database scans.
  • Distinguish frequent, closed, and maximal frequent itemsets with examples.
  • Explain why high confidence may still be misleading and when lift equals 1.
  • Solve statement I/II and match-list questions on association mining terms.
  • Identify association mining applications such as cross-selling and link analysis.
  • Explain why Apriori is unsupervised and why it is not classification.

Attempt the PARIKSHA sub-topic test first, then take the subject test.

Pages 1–2 of 2