Docsity

Mining Association Rules in Large Databases - Data Warehousing - Lecture Slide, Slides of Data Warehousing

Partial preview of the text

Download Mining Association Rules in Large Databases - Data Warehousing - Lecture Slide and more Slides Data Warehousing in PDF only on Docsity!

Mining Association Rules in Large

Databases

Chapter 6: Mining Association

Rules in Large Databases

 Association rule mining

 Mining single-dimensional Boolean association rules

from transactional databases

 DBMiner

 Mining multilevel association rules from transactional

databases

 Mining multidimensional association rules from

transactional databases and data warehouse

 From association mining to correlation analysis

 Constraint-based association mining

 Summary

Association Rule: Basic Concepts

 Given: (1) database of transactions, (2) each transaction is a

list of items (purchased by a customer in a visit)

 Find: all rules that correlate the presence of one set of items

with that of another set of items

  • E.g., 98% of people who purchase tires and auto accessories also get automotive services done

 Applications

  • *Maintenance Agreement (What the store should do to boost Maintenance Agreement sales)
  • Home Electronics* (What other products should the store stocks up?)
  • Attached mailing in direct marketing
  • Detecting ―ping-pong‖ing of patients, faulty ―collisions‖

Rule Measures: Support and

Confidence

 Find all the rules X & YZ with

minimum confidence and support

  • support, s , probability that a transaction contains {X  Y  Z}
  • confidence, c, conditional probability that a transaction having {X  Y} also contains Z

Transaction ID Items Bought

2000 A,B,C

1000 A,C

4000 A,D

5000 B,E,F

Let minimum support 50%, and

minimum confidence 50%, we

have

  • AC (50%, 66.6%)
  • CA (50%, 100%)

Customer buys diaper

Customer buys both

Customer buys beer

Mining Association Rules—An

Example

For rule A  C :

support = support({ A  C }) = 50%

confidence = support({ A  C })/support({ A }) = 66.6%

The Apriori principle:

Any subset of a frequent itemset must be frequent

Transaction ID Items Bought

2000 A,B,C

1000 A,C

4000 A,D

5000 B,E,F

Frequent Itemset Support

{A} 75%

{B} 50%

{C} 50%

{A,C} 50%

Min. support 50%

Min. confidence 50%

Mining Frequent Itemsets: the

Key Step

 Find the frequent itemsets : the sets of items that have

the minimum support

  • A subset of a frequent itemset must also be a frequent itemset  i.e., if { AB } is a frequent itemset, both { A } and { B } should be a frequent itemset
  • Iteratively find frequent itemsets with cardinality from 1 to k (k- itemset )

 Use the frequent itemsets to generate association rules.

The Apriori Algorithm — Example

TID Items 100 1 3 4 200 2 3 5 300 1 2 3 5 400 2 5

Database D itemset sup.

itemset sup.

Scan D

C 1 L^1

itemset

itemset sup {1 2} 1 {1 3} 2 {1 5} 1 {2 3} 2 {2 5} 3 {3 5} 2

itemset sup {1 3} 2 {2 3} 2 {2 5} 3 {3 5} 2

L 2

C 2 C 2

Scan D

C 3 itemset L 3

Scan D itemset^ sup {2 3 5} 2

Minimum support count = 2

1,2,3 – 1,2 not freq 1,3,5 – 1,5 not freq 2,3,

How to Generate Association Rules

from Frequent Itemsets?

 Done using the following equation for confidence

  • Where the conditional probability is expressed in terms of itemset support counts

 Confidence (A=>B) = P(B/A) = support_count(A B)

/support_count(A)

  • support_count(A  B) = # transactions containing itemsets A  B
  • support_count(A) = # transactions containing the itemset A

 Generate as follows :

  • For each frequent itemset l, generate all nonempty subsets of l
  • For every nonempty subset of I, output the rule ―s=>(l-s)‖ if support_count(l)/support_count(s) >= min_conf (minimum confidence threshold)

Methods to Improve Apriori’s

Efficiency

 Hash-based technique: A k -itemset whose corresponding hashing

bucket count is below the threshold cannot be frequent

 Transaction reduction: A transaction that does not contain any

frequent k-itemset can be removed in subsequent scans

 Partitioning: Any itemset that is potentially frequent in DB must

be frequent in at least one of the partitions of DB

 Sampling: mining on a subset of given data, lower support

threshold + a method to determine the completeness

 Dynamic itemset counting: add new candidate itemsets only when

all of their subsets are estimated to be frequent

Is Apriori Fast Enough? —

Performance Bottlenecks

 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 the candidate itemsets

 The bottleneck of Apriori : candidate generation

  • Huge candidate sets:  104 frequent 1-itemset will generate 10^7 candidate 2-itemsets  To discover a frequent pattern of size 100, e.g., {a 1 , a 2 , …, a 100 }, one needs to generate 2^100  1030 candidates.
  • Multiple scans of database:  Needs ( n + 1 ) scans, n is the length of the longest pattern

Presentation of Association Rules

(Table Form )

Visualization of Assn Rule Using Plane Graph (rule bar)

DBMiner Examples

 Show Examples 1 - 11

Iceberg Queries

 Iceberg query: Compute aggregates over one or a set of

attributes only for those whose aggregate values is above

certain threshold

 Example:

select P.custID, P.itemID, sum (P.qty) from purchase P group by P.custID, P.itemID having sum (P.qty) >= 3

 Compute iceberg queries more efficiently by Apriori:

  • First generate cust_list (those who bought 3 or more items) and item_list (items purchased by any customer in quantities of 3 or more)
  • Only generate cust/items pairs from lists  This eliminates many cust/item pairs that would otherwise have been generated