





















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















































Lecture #
-^ Today’s Reading:– HMS 6.7, ch. 13•^ Today’s Lecture:– Finding Patterns and Rules - Association Rules -^ Upcoming Due Dates:– H3 due today– Project Writeup due 4/
emphasis on a single attribute
full description of the data
characterizes local aspects of data
attributes– among the large number of rules generated, how do wedetermine interesting rules?
Finding frequent patterns, associations, correlations, or causalstructures among sets of items or objects in transactiondatabases, relational databases, and other informationrepositories.
Basket data analysis, cross-marketing, catalog design, loss-leaderanalysis, clustering, classification, etc.
Rule form:
“Body
ead [support, confidence]”.
-^ buys(x, “diapers”)
→^ buys(x, “beers”) [0.5%, 60%]
-^ major(x, “CS”) ^ takes(x, “DB”)
→^ grade(x, “A”) [1%, 75%]
1.^ database of transactions,2.^ each transaction is a list of items (purchased by a customer in avisit), called a
E.g.,
baskets = documents; items = words– baskets = web pages; items = links
common sizesnumber of transactions: 10
5 – 10
8
number of items: 10
2 – 10
6
-^ typically sparse, 0.1% chance of random purchase–^ commonly stored•
in a relational data base, Baskets(BID,item)• flat file (BID,item
,item 1
,…,item 2
)n
count the number of passes through the data– principle cost time to read data from disk
Let minimum support 50%, and minimum confidence 50%,we have:
Frequent Itemset Support{A}^
75%
{B}^
50%
{C}^
50%
{A,C}
50%
For rule
support = support({
A,C}) = 50%
confidence = support({
A,C})/support({
A}) = 66.6%
then frequent pairs, next frequent triples• most time consuming step is often finding pairs• one pass over the data is made for each level– Find all maximal frequent itemsets (I.e., sets S such that noproper superset of S is frequent)• one or several passes over the data
Cis generated by joining Lk^
with itselfk-
Any (k-1)-itemset that is not frequent cannot be a subset of a frequent k-itemset
C: Candidate itemset of size kk^ L: frequent itemset of size kk^ L= {frequent items};^1 for^ (k = 1;
L!=∅k^
;k++)
do begin
C= candidates generated fromk+^
L;k^
for each
transaction
t in database do increment the count of all candidates in
Ck+
that are contained in
t
L= candidates ink+^
Cwith min_supportk+^
endreturn^ ∪
L; k k^
insert into
Ck select
p.item
, p.item 1
, …, p.item 2
, q.itemk-
k-
from^ L
p, Lk-^
qk-^ where
p.item
=q.item 1
, …, p.item 1
=q.itemk-
, p.itemk-
< q.itemk-
k-
1
itemsets c in C
do k
forall
(k-1)-subsets s of c
do
if^ (s is not in L
)^ then delete k-
c^ from
Ck
One transaction may contain many candidates
-^ Hash-based itemset counting: A
hashing bucket count is below the threshold cannot be frequent• Transaction reduction: A transaction that does not contain anyfrequent k-itemset is useless in subsequent scans• Partitioning: Any itemset that is potentially frequent in DB must befrequent in at least one of the partitions of DB• Sampling: mining on a subset of given data, lower supportthreshold + a method to determine the completeness• Dynamic itemset counting: add new candidate itemsets only whenall of their subsets are estimated to be frequent
-^ The core of the Apriori algorithm:–
Use frequent (
k – 1)-itemsets to generate candidate frequent
k-itemsets
-^ Use database scan and pattern matching to collect counts for thecandidate itemsets• The bottleneck of
Apriori: candidate generation
4 frequent 1-itemset will generate 10
7 candidate 2-itemsets
, a, …, a 12
}, one 100
needs to generate 2
100 ≈^10
30 candidates.
n +1 ) scans,
n^ is the length of the longest pattern