Anda di halaman 1dari 3

Apriori Algorithm

Find the item sets in the following database of nine transactions, with a minimum support 50% and
confidence 50%.

Transaction ID Items Bought


2000 A, B, C
1000 A, C
4000 A, D
5000 B, E, F

Solution:

Here there are 4 transactions and minimum support is 50% and confidence is 50%.

So now converting 50% support in to integer number.

50 x 4 /100 = 2 that means every item (i.e. A, B, C, D and F) must be present at least in 2 transactions.

Step 1: Now, we shall consider the single subset. Scan D for count of each candidate. The candidate list
is {A, B, C, D, E, F} and find the support

C1 =

Items Support
{A} 3
{B} 2
{C} 2
{D} 1
{E} 1
{F} 1

Now we shall eliminate those items whose support count is less than 2. So D, E and F have got
eliminated.

Step 2: Compare candidate support count with minimum support count (50%)

L1 =

Items Support Count


{A} 3
{B} 2
{C} 2

Step 3: Generate candidate C2 from L1

C2 =

Items
{A, B}
{A, C}
{B, C}

Step 4: Scan D for count of each candidate in C2 and find the support

C2 =

Items Support Count


{A, B} 1
{A, C} 2
{B, C} 1

In C2, we have considered 2-subset.

Step 5: Compare candidate (C2) support count with the minimum support count

L2 =

Items Support Count


{A, C} 2

Step 6: So data contain the frequent item I(A, C)

Therefore, the association rule that can be generated from L are as shown below with the support and
confidence

Association Rule Support Confidence Confidence %


A -> C 2 2/3 = 0.66 66 %
C -> A 2 2/2 = 1 100 %

Confidence can be calculated in this way that support count (here it is 2) / number of occurrences i.e.
2/3 = 0.66 and similarly 2/2 = 1.

Minimum confidence threshold is 50% (Given), then both the rules are output as the confidence is
above 50%.

So the final rules are

Rule 1: A -> C

Rule 2: C -> A

https://www.youtube.com/watch?v=JZepOmvB514

https://www.youtube.com/watch?v=LZii6N4vGDs
fp growth algorithm

https://www.youtube.com/watch?v=gq6nKbye648

Anda mungkin juga menyukai