Docsity

Association Rules-Data Mining-Lecture 02 Slides-Computer Science, Slides of Data Mining

Partial preview of the text

Download Association Rules-Data Mining-Lecture 02 Slides-Computer Science and more Slides Data Mining in PDF only on Docsity!

“Association Rules”

Market Baskets

Frequent Itemsets

A-priori Algorithm

The Market-Basket Model

A large set of

items

, e.g., things sold in

a supermarket.

A large set of

baskets

, each of which is

a small set of the items, e.g., the thingsone customer buys on one day.

Example

Items={milk, coke, pepsi, beer, juice}.

Support = 3 baskets.

B1 = {m, c, b}

B2 = {m, p, j}

B3 = {m, b}

B4 = {c, j}

B5 = {m, p, b}

B6 = {m, c, b, j}

B7 = {c, b, j}

B8 = {b, c}

Frequent itemsets: {m}, {c}, {b}, {j}, {m, b}, {c, b}, {j, c}.

Applications --- (1)

Real market baskets: chain stores keep terabytes of information about whatcustomers buy together.



Tells how typical customers navigatestores, lets them position tempting items.



Suggests tie-in “tricks,” e.g., run sale ondiapers and raise the price of beer.

High support needed, or no $$’s.

Applications --- (3)

“Baskets” = Web pages; “items” = linked pages.



Pairs of pages with many commonreferences may be about the same topic.

“Baskets” = Web pages

p

; “items” =

pages that link to

p



Pages with many of the same links may bemirrors or about the same topic.

Important Point

“Market Baskets” is an abstraction that models any many-many relationshipbetween two concepts: “items” and“baskets.”



Items need not be “contained” in baskets.

The only difference is that we count co- occurrences of items related to abasket, not vice-versa.

Association Rules

If-then rules about the contents of baskets.

i

1

i

2

i

k

j

means: “if a basket

contains all of

i

1

i

k

then it is likely to

contain

j

Confidence

of this association rule is

the probability of

j

given

i

1

i

k

Example

B1 = {m, c, b}

B2 = {m, p, j}

B3 = {m, b}

B4 = {c, j}

B5 = {m, p, b}

B6 = {m, c, b, j}

B7 = {c, b, j}

B8 = {b, c}

An association rule:

{m, b}

c



Confidence = 2/4 = 50%.

  • _ _

Example

B1 = {m, c, b}

B2 = {m, p, j}

B3 = {m, b}

B4 = {c, j}

B5 = {m, p, b}

B6 = {m, c, b, j}

B7 = {c, b, j}

B8 = {b, c}

For association rule

{m, b}

c

, item

c

appears in 5/8 of the baskets.

Interest = | 2/4 - 5/8 | = 1/8 --- not very interesting.

Relationships Among Measures

Rules with high support and confidence may be useful even if they are not“interesting.”



We don’t care if buying bread causes people to buy milk, or whether simply a lotof people buy both bread and milk.

But high interest suggests a cause that might be worth investigating.

Computation Model

Typically, data is kept in a “flat file” rather than a database system.



Stored on disk.



Stored basket-by-basket.



Expand baskets into pairs, triples, etc. asyou read baskets.

17

Computation Model --- (2)

The true cost of mining disk-resident data is usually the

number of disk I/O’s

In practice, association-rule algorithms read the data in passes --- all basketsread in turn.

Thus, we measure the cost by the number of passes an algorithm takes.

Finding Frequent Pairs

The hardest problem often turns out to be finding the frequent pairs.

We’ll concentrate on how to do that, then discuss extensions to findingfrequent triples, etc.

Naïve Algorithm

A simple way to find frequent pairs is:



Read file once, counting in main memorythe occurrences of each pair.

Expand each basket of

n

items into its

n

(

n

-1)/2 pairs.

Fails if #items-squared exceeds main memory.