Frequent Pattern Mining. Based on: Introduction to Data Mining by Tan, Steinbach, Kumar

Similar documents
Mining Association Rules in Large Databases

Apriori Algorithm. 1 Bread, Milk 2 Bread, Diaper, Beer, Eggs 3 Milk, Diaper, Beer, Coke 4 Bread, Milk, Diaper, Beer 5 Bread, Milk, Diaper, Coke

Chapter 4: Association analysis:

Chapter 7: Frequent Itemsets and Association Rules

Chapter 7: Frequent Itemsets and Association Rules

Chapter 4: Mining Frequent Patterns, Associations and Correlations

Market baskets Frequent itemsets FP growth. Data mining. Frequent itemset Association&decision rule mining. University of Szeged.

Frequent Pattern Mining S L I D E S B Y : S H R E E J A S W A L

Chapter 6: Basic Concepts: Association Rules. Basic Concepts: Frequent Patterns. (absolute) support, or, support. (relative) support, s, is the

Data Mining Clustering

Data Structures. Notes for Lecture 14 Techniques of Data Mining By Samaher Hussein Ali Association Rules: Basic Concepts and Application

DATA MINING II - 1DL460

Data Mining Part 3. Associations Rules

Chapter 6: Association Rules

Association Rules. A. Bellaachia Page: 1

Frequent Pattern Mining

Frequent Item Sets & Association Rules

Association Analysis: Basic Concepts and Algorithms

BCB 713 Module Spring 2011

Association rules. Marco Saerens (UCL), with Christine Decaestecker (ULB)

Lecture Topic Projects 1 Intro, schedule, and logistics 2 Data Science components and tasks 3 Data types Project #1 out 4 Introduction to R,

Introduction to Data Mining

Effectiveness of Freq Pat Mining

Frequent Pattern Mining

Mining Frequent Patterns without Candidate Generation

CS570 Introduction to Data Mining

CS 6093 Lecture 7 Spring 2011 Basic Data Mining. Cong Yu 03/21/2011

Data Mining Techniques

Data Warehousing and Data Mining. Announcements (December 1) Data integration. CPS 116 Introduction to Database Systems

Performance and Scalability: Apriori Implementa6on

Data Warehousing & Mining. Data integration. OLTP versus OLAP. CPS 116 Introduction to Database Systems

CHAPTER 8. ITEMSET MINING 226

Basic Concepts: Association Rules. What Is Frequent Pattern Analysis? COMP 465: Data Mining Mining Frequent Patterns, Associations and Correlations

Association Rule Mining: FP-Growth

Association Pattern Mining. Lijun Zhang

Association Rule Mining (ARM) Komate AMPHAWAN

Association Rules Apriori Algorithm

Data Mining: Concepts and Techniques. (3 rd ed.) Chapter 6

Association Rule Mining

Association Rules Apriori Algorithm

Advance Association Analysis

OPTIMISING ASSOCIATION RULE ALGORITHMS USING ITEMSET ORDERING

Fundamental Data Mining Algorithms

Nesnelerin İnternetinde Veri Analizi

Unsupervised learning: Data Mining. Associa6on rules and frequent itemsets mining

Production rule is an important element in the expert system. By interview with

PFPM: Discovering Periodic Frequent Patterns with Novel Periodicity Measures

CSE 5243 INTRO. TO DATA MINING

Data Mining: Concepts and Techniques. Chapter 5. SS Chung. April 5, 2013 Data Mining: Concepts and Techniques 1

Jeffrey D. Ullman Stanford University

Roadmap. PCY Algorithm

ANU MLSS 2010: Data Mining. Part 2: Association rule mining

CS246: Mining Massive Datasets Jure Leskovec, Stanford University

Data Mining for Knowledge Management. Association Rules

Data Warehousing and Data Mining

We will be releasing HW1 today It is due in 2 weeks (1/25 at 23:59pm) The homework is long

1. Interpret single-dimensional Boolean association rules from transactional databases

High dim. data. Graph data. Infinite data. Machine learning. Apps. Locality sensitive hashing. Filtering data streams.

Association Rules Outline

What Is Data Mining? CMPT 354: Database I -- Data Mining 2

Association mining rules

Decision Support Systems

A Novel method for Frequent Pattern Mining

Improvements to A-Priori. Bloom Filters Park-Chen-Yu Algorithm Multistage Algorithm Approximate Algorithms Compacting Results

signicantly higher than it would be if items were placed at random into baskets. For example, we

2. Discovery of Association Rules

CompSci 516 Data Intensive Computing Systems

Association Rule Mining. Entscheidungsunterstützungssysteme

Tutorial on Assignment 3 in Data Mining 2009 Frequent Itemset and Association Rule Mining. Gyozo Gidofalvi Uppsala Database Laboratory

Chapter 13, Sequence Data Mining

Pattern Mining. Knowledge Discovery and Data Mining 1. Roman Kern KTI, TU Graz. Roman Kern (KTI, TU Graz) Pattern Mining / 42

INTRODUCTION TO DATA MINING ASSOCIATION RULES. Luiza Antonie

Knowledge Discovery in Databases II Winter Term 2015/2016. Optional Lecture: Pattern Mining & High-D Data Mining

Frequent and Sequential Pattern Mining with Multiple Minimum Supports

Knowledge Discovery in Databases

数据挖掘 Introduction to Data Mining

Association Rule Learning

Mining Association Rules in Large Databases

Chapter 4 Data Mining A Short Introduction

Building Roads. Page 2. I = {;, a, b, c, d, e, ab, ac, ad, ae, bc, bd, be, cd, ce, de, abd, abe, acd, ace, bcd, bce, bde}

Association Rule Discovery

Big Data Analytics CSCI 4030

CompSci 516 Data Intensive Computing Systems

Tutorial on Association Rule Mining

Improved Frequent Pattern Mining Algorithm with Indexing

COMP Associa0on Rules

Data Mining Algorithms

Efficient Computation of Data Cubes. Network Database Lab

Model for Load Balancing on Processors in Parallel Mining of Frequent Itemsets

Data mining, 4 cu Lecture 6:

Roadmap DB Sys. Design & Impl. Association rules - outline. Citations. Association rules - idea. Association rules - idea.

Association Rule Discovery

CLOSET+:Searching for the Best Strategies for Mining Frequent Closed Itemsets

CHAPTER 5 WEIGHTED SUPPORT ASSOCIATION RULE MINING USING CLOSED ITEMSET LATTICES IN PARALLEL

Sequential Data. COMP 527 Data Mining Danushka Bollegala

Parallel Bifold: Large-Scale Parallel Pattern Mining with Constraints

CSE 5243 INTRO. TO DATA MINING

Induction of Association Rules: Apriori Implementation

Interestingness Measurements

Machine Learning: Symbolische Ansätze

Transcription:

Frequent Pattern Mining Based on: Introduction to Data Mining by Tan, Steinbach, Kumar

Item sets A New Type of Data Some notation: All possible items: Database: T is a bag of transactions Transaction transaction identifier: TID item set

Definitions

Definitions Itemset A collection of one or more items Example: {Milk, Bread, Diaper} k-itemset An itemset that contains k items

Definitions Itemset A collection of one or more items Example: {Milk, Bread, Diaper} k-itemset An itemset that contains k items Support count σ() Frequency of occurrence of an itemset E.g. σ({milk, Bread, Diaper}) = 2

Definitions Itemset A collection of one or more items Example: {Milk, Bread, Diaper} k-itemset An itemset that contains k items Support count σ() Frequency of occurrence of an itemset E.g. σ({milk, Bread, Diaper}) = 2 Support s() Fraction of transactions that contain an itemset E.g. s({milk, Bread, Diaper}) = 2/5

Definitions Itemset A collection of one or more items Example: {Milk, Bread, Diaper} k-itemset An itemset that contains k items Support count σ() Frequency of occurrence of an itemset E.g. σ({milk, Bread, Diaper}) = 2 Support s() Fraction of transactions that contain an itemset E.g. s({milk, Bread, Diaper}) = 2/5 Frequent Itemset An itemset whose support is greater than or equal to a minsup threshold

Association Rule Mining Given a set of transactions, find rules that predict the occurrence of an item based on occurrences of other items in the transaction Example of Association Rules {Diaper} {Beer}, {Milk, Bread} {Eggs,Cola}, {Beer, Bread} {Milk}, means co-occurrence

Definitions

Definitions Association Rule Expression of the form X Y (X and Y are itemsets)

Definitions Association Rule Expression of the form X Y (X and Y are itemsets) Example: {Milk, Diaper} {Beer} Rule Evaluation Measures Support (s) Fraction of transactions that contain both X and Y Confidence (c)

Definitions Association Rule Expression of the form X Y (X and Y are itemsets) Example: {Milk, Diaper} {Beer} Rule Evaluation Measures Support (s) Fraction of transactions that contain both X and Y Confidence (c) Measures how often items in Y appear in transactions that contain X

Definitions Association Rule Expression of the form X Y (X and Y are itemsets) Example: {Milk, Diaper} {Beer} Rule Evaluation Measures Support (s) Fraction of transactions that contain both X and Y Confidence (c) Measures how often items in Y appear in transactions that contain X Example:

Association Rule Mining Task Example of Rules: {Milk,Diaper} {Beer} (s=0.4, c=0.67) {Milk,Beer} {Diaper} (s=0.4, c=1.0) {Diaper,Beer} {Milk} (s=0.4, c=0.67) {Beer} {Milk,Diaper} (s=0.4, c=0.67) {Diaper} {Milk,Beer} (s=0.4, c=0.5) {Milk} {Diaper,Beer} (s=0.4, c=0.5)

Association Rule Mining Task Given set of transactions T, find all rules having support minsup threshold confidence minconf threshold Example of Rules: {Milk,Diaper} {Beer} (s=0.4, c=0.67) {Milk,Beer} {Diaper} (s=0.4, c=1.0) {Diaper,Beer} {Milk} (s=0.4, c=0.67) {Beer} {Milk,Diaper} (s=0.4, c=0.67) {Diaper} {Milk,Beer} (s=0.4, c=0.5) {Milk} {Diaper,Beer} (s=0.4, c=0.5)

Mining Association Rules Brute-force approach: List all possible association rules Compute the support and confidence for each rule Prune rules that fail the minsup and minconf thresholds Computationally prohibitive (combinatorial explosion) Can we do better? {Milk,Diaper} {Beer} (s=0.4, c=0.67) {Milk,Beer} {Diaper} (s=0.4, c=1.0) {Diaper,Beer} {Milk} (s=0.4, c=0.67) {Beer} {Milk,Diaper} (s=0.4, c=0.67) {Diaper} {Milk,Beer} (s=0.4, c=0.5) {Milk} {Diaper,Beer} (s=0.4, c=0.5)

Observations: Mining Association Rules All rules are binary partitions of the same itemset: " {Milk, Diaper, Beer} Rules originating from the same itemset have identical support but can have different confidence Thus, we may decouple the support and confidence requirements {Milk,Diaper} {Beer} (s=0.4, c=0.67) {Milk,Beer} {Diaper} (s=0.4, c=1.0) {Diaper,Beer} {Milk} (s=0.4, c=0.67) {Beer} {Milk,Diaper} (s=0.4, c=0.67) {Diaper} {Milk,Beer} (s=0.4, c=0.5) {Milk} {Diaper,Beer} (s=0.4, c=0.5)

Mining Association Rules Two-step approach: Frequent Itemset Generation (count support) Generate all itemsets whose support minsup Rule Generation (count confidence) Generate high confidence rules from each frequent itemset, where each rule is a binary partitioning of a frequent itemset

Frequent Itemset Generation Still computationally expensive: d items: 2 d candidate itemsets

Frequent Itemset Generation Brute force: Match every itemset against transaction database M (2 d ) itemsets, N transactions: Complexity ~ O(NMw)!

Computational Complexity Given d unique items: Total number of itemsets = 2 d Total number of possible association rules: If d=6, R = 602 rules

Frequent Itemset Generation Strategies Need to: Reduce the number of candidates (M) Pruning Reduce the number of comparisons (NM) Efficient support counting

Quiz: which itemsets 1) Reduce number of candidates can be pruned? Infrequent

Quiz: which itemsets 1) Reduce number of candidates can be pruned? Infrequent Pruned

Apriori Principle If an itemset is frequent, then all of its subsets must also be frequent Support of itemset never exceeds the support of its subsets Anti-monotonicity

Apriori Principle Items (1-itemsets) Pairs (2-itemsets) (No need to generate candidates involving Coke or Eggs) Minimum Support = 3 Triplets (3-itemsets) If every subset is considered, 6 C 1 + 6 C 2 + 6 C 3 = 41 With support-based pruning, 6 + 6 + 1 = 13

Apriori Algorithm Method: Let k=1 Generate frequent itemsets of length 1 Repeat until no new frequent itemsets are identified Generate length (k+1) candidate itemsets from length k frequent itemsets Prune candidate itemsets containing subsets of length k that are infrequent Count the support of each candidate by scanning the DB Eliminate infrequent candidates, leaving only those that are frequent

Apriori Algorithm: Level 1 candidate support Frequent? A 6 Y B 7 Y C 6 Y D 2 Y E 2 Y Minimum Support = 2 TID Items 1 ABE 2 BD 3 BC 4 ABD 5 AC 6 BC 7 AC 8 ABCE 9 ABC Level 2 candidates?

Apriori Algorithm: Level 2 candidate support Frequent? AB 4 Y AC 4 Y AD 1 N AE 2 Y BC 4 Y BD 2 Y BE 2 Y CD 0 N CE 1 N DE 0 N TID Items 1 ABE 2 BD 3 BC 4 ABD 5 AC 6 BC 7 AC 8 ABCE 9 ABC Level 3?

Apriori Algorithm: Level 3 candidate support Frequent? ABC 2 Y ABE 2 Y TID Items 1 ABE 2 BD 3 BC 4 ABD 5 AC 6 BC 7 AC 8 ABCE 9 ABC Level 4?

2) Reduce Number of Comparisons candidate support Frequent AB 4 Y AC 4 Y AD 1 N AE 2 Y BC 4 Y BD 2 Y BE 2 Y CD 0 N CE 1 N DE 0 N Look-up TID Items 1 ABE 2 BD 3 BC 4 ABD 5 AC 6 BC 7 AC 8 ABCE 9 ABC Quiz: efficient data structure to look up items in a list?

2) Reduce Number of Comparisons candidate support Frequent? AB 4 Y AC 4 Y AD 1 N AE 2 Y BC 4 Y BD 2 Y BE 2 Y CD 0 N CE 1 N DE 0 N Hash maps! Key A,C,E B,D Look-up TID Items 1 ABE 2 BD 3 BC 4 ABD 5 AC 6 BC 7 AC 8 ABC 9 ABC Value AB, AC, AD, AE, CD, CE BC, BD, BE, DE

Factors Affecting Complexity Minimum support threshold lower support threshold: more frequent itemsets increases number and length of candidate itemsets Dimensionality (number of items) more space needed to store support counts if many frequent items: computation and I/O cost increase Size of database (number of transactions) increases run time (Apriori makes multiple passes) Transaction width (dense datasets) increases number of subsets increases length of frequent itemsets and hash tree traversals

Back to Association Rules Given a frequent itemset L, find all non-empty subsets f L such that f L f satisfies the minimum confidence requirement If {A,B,C,D} is a frequent itemset, candidate rules ABC D, " ABD C, " ACD B, " BCD A, A BCD," B ACD," C ABD, " D ABC AB CD," AC BD, " AD BC, " BC AD, BD AC, " CD AB If L = k, then there are 2 k 2 candidate association rules (ignoring L and L)

Rule Generation How to efficiently generate rules? Confidence is not anti-monotone c(abc D) can be larger or smaller than c(ab D) Confidence of rules generated from the same itemset is! e.g., L = {A,B,C,D}: " " c(abc D) c(ab CD) c(a BCD) Anti-monotone w.r.t. number of items on the RHS of the rule

Rule Generation Quiz: which rules have low confidence? Low Confidence Rule

Rule Generation Quiz: which rules have low confidence? Low Confidence Rule Pruned Rules Low confidence

Rule Generation for Apriori Algorithm Candidate rule generated by merging two highconfidence rules with same prefix on right hand side Prune D=>ABC if subset AD=>BC has low confidence

Maximal Frequent Itemset Itemset is maximal frequent if none of its immediate supersets is frequent Quiz: which ones? Infrequent Itemsets Infrequency border

Maximal Frequent Itemset Itemset is maximal frequent if none of its immediate supersets is frequent Quiz: which ones? Maximal Itemsets Infrequent Itemsets Infrequency border

Closed Itemset An itemset is closed if none of its (immediate) supersets has the same support Quiz: which ones are closed?

Closed Itemset An itemset is closed if none of its (immediate) supersets has the same support Quiz: which ones are closed?

Quiz: which are frequent, closed, maximal? Minimum support = 2 Transaction Ids Not supported by any transactions

Quiz: which are frequent, closed, maximal? Minimum support = 2 Transaction Ids Not supported by any transactions

Quiz: which are frequent, closed, maximal? Minimum support = 2 Transaction Ids Not supported by any transactions

Quiz: which are frequent, closed, maximal? Minimum support = 2 Transaction Ids Not supported by any transactions

Quiz: which are frequent, closed, maximal? Minimum support = 2 Transaction Ids Not supported by any transactions

Quiz: which are frequent, closed, maximal? Minimum support = 2 Transaction Ids Not supported by any transactions

Quiz: which are frequent, closed, maximal? Minimum support = 2 Transaction Ids Not supported by any transactions

Quiz: which are frequent, closed, maximal? Minimum support = 2 Closed but not maximal Closed and maximal Not supported by any transactions

Maximal vs Closed Itemsets

Exam question For minsup=0.3, draw the itemset lattice and label each node with: I = infrequent itemset C = closed itemset M = maximal itemset Compute support and confidence for: