0% found this document useful (0 votes)
6 views

Association Rule Mining

The document discusses the concepts of frequent pattern and association rule mining, particularly focusing on the Apriori algorithm for finding frequent itemsets. It highlights the importance of these techniques in various applications such as e-commerce recommendations and market basket analysis. The learning objectives include understanding basic concepts, implementing the Apriori algorithm, and generating strong association rules.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Association Rule Mining

The document discusses the concepts of frequent pattern and association rule mining, particularly focusing on the Apriori algorithm for finding frequent itemsets. It highlights the importance of these techniques in various applications such as e-commerce recommendations and market basket analysis. The learning objectives include understanding basic concepts, implementing the Apriori algorithm, and generating strong association rules.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Mining Frequent Patterns, Association Rule

Mining

Prof. K. Thammi Reddy


Professor – Dept. of CSE School of
Engineering & Sciences (SoES)

04/16/2025
Technique behind the E-commerce recommendation system

2
Learning objectives

 Basic concepts of Association Rule mining

 Finding Frequent Itemsets using Apriori

Algorithm

 Generating strong association rules

 Exercise on Apriori Algorithm

3
Motivation & History

First proposed by R. Agrawal and R. Srikant in the context


of frequent itemsets and association rule mining
Motivation: Finding inherent regularities in data
What products were often purchased together?— Bread
and Butter?!
What are the subsequent purchases after buying a PC?
What kinds of DNA are sensitive to this new drug?
Can we automatically classify web documents?
Applications
Basket data analysis, cross-marketing, catalog design,
sale campaign analysis, Web log (click stream) analysis,
and DNA sequence analysis

4
Why you need to undergo this
topic?

Most of us are using E-commerce websites for


buying house hold items.

Example:
Amazon(2005) , Bigbasket (2011) , Flipcart (2007),
etc.

5
What Is Frequent Pattern
Analysis?
 Frequent pattern: a pattern (a set of items, subsequences,
substructures, etc.) that occurs frequently in a data set
 Association Rule:
An association rule has two parts: an antecedent (if) and a
consequent
(then). An antecedent is an item found within the data. A
consequent is
an item found in combination with the antecedent.

 computer antivirus software [support = 2%, confidence =


60%].
usefulness and certainty of discovered rules
6
What Is Frequent Pattern
Analysis?
Association Rule mining can be viewed as two step process:

7
Basic Concepts: Frequent
Patterns
 itemset: A set of one or more items
 k-itemset I = {I1, …, Ik}
 Transaction Database T: a set of transactions
T = {t1, t2, …, tn}.
 support count of I: Frequency or occurrence of an
itemset I
 (relative) support, s, is the fraction of transactions
that contains I (i.e., the probability that a transaction
contains I)
8
Transaction data: supermarket
data
 Market basket transactions:
t1: {bread, cheese, milk}
t2: {apple, eggs, salt, yogurt}
… …
tn: {biscuit, eggs, milk}
 Concepts:
 An item: an item/article in a basket

 I: the set of all items sold in the store

 A transaction: items purchased in a

basket; it may have TID (transaction ID)


 A transactional dataset: A set of

transactions 9
The model: rules
 A transaction t contains X, a set of items
(itemset) in I, if X  t.
 An association rule is an implication of the
form:
X  Y, where X, Y  I, and X Y = 

 An itemset is a set of items.


 E.g., X = {milk, bread, cereal} is an

itemset.
 A k-itemset is an itemset with k items.
 E.g., {milk, bread, cereal} is a 3-itemset

10
Rule strength measures
 Support: The rule holds with support sup in
T (the transaction data set) if sup% of
transactions contain X  Y.
 sup = Pr(X  Y).

 Confidence: The rule holds in T with


confidence conf if conf% of tranactions
that contain X also contain Y.
 conf = Pr(Y | X)

 An association rule is a pattern that states


when X occurs, Y occurs with certain
probability.

11
Step 1: Mining all frequent
itemsets
 A frequent itemset is an itemset whose
support is ≥ minsup.
 Key idea: The apriori property (downward
closure property): any subsets of a frequent
itemset are also frequent itemsets
ABC ABD ACD BCD

AB AC AD BC BD CD

A B C D

12
Closed Itemset:
An itemset is closed if none of its immediate
supersets have same support count same as
Itemset.
 What is the set of closed itemset?
 <a1, …, a100>: 1
 < a1, …, a50>: 2

Max frequent itemset:


If itemset does not have any frequent
supersets, then the itemset is called Max
frequent itemset.
<a , …, a >: 1 13
Illustrating Apriori Principle
null

A B C D E

AB AC AD AE BC BD BE CD CE DE

Found to be
Infrequent
ABC ABD ABE ACD ACE ADE BCD BCE BDE CDE

ABCD ABCE ABDE ACDE BCDE

Pruned
ABCDE
supersets
The Apriori Algorithm
 Iterative algo. (also called level-wise
search): Find all 1-item frequent itemsets;
then all 2-item frequent itemsets, and so on.
 In each iteration k, only consider
itemsets that contain some k-1 frequent
itemset.
 Find frequent itemsets of size 1: F1
 From k = 2

Ck = candidates of size k: those itemsets
of size k that could be frequent, given Fk-
1

Fk = those itemsets that are actually 15
Transactional data

16
17
18
19
Generating Strong Rules

20
Learning Outcomes

After completion the student will be able to:

1. understand the use of frequent patterns in


business analysis
2. implement Apriori algorithm
3. learn different types of association rules

21

You might also like