Re: How to calculate support and confidence?
Date: July 26, 2015 02:55AM
The explanation by THomas is correct.
Here is another explanation that will perhaps help you.
Consider that transaction database:
Transaction id Items
t1 {1, 2, 4, 5}
t2 {2, 3, 5}
t3 {1, 2, 4, 5}
t4 {1, 2, 3, 5}
t5 {1, 2, 3, 4, 5}
t6 {2, 3, 4}
The output of an association rule mining algorithm is a set of association rules respecting the user-specified minsup and minconf thresholds.
An association rule X==>Y is a relationship between two itemsets (sets of items) X and Y such that the intersection of X and Y is empty.
The support of a rule is the number of transactions that contains X∪Y. The confidence of a rule is the number of transactions that contains X∪Y divided by the number of transactions that contain X.
If we apply an association rule mining algorithm, it will return all the rules having a support and confidence respectively no less than minsup and minconf.
For example, by applying the algorithm with minsup = 0.5 (50%), minconf = 0.6 (60%), we obtains 55 associations rules.
Here are three of those rules
1 ==> 2 4 5 support: 3 confidence: 0,75
5 ==> 1 2 4 support: 3 confidence: 0,6
4 ==> 1 2 5 support: 3 confidence: 0,75
The rule 1 ==> 2 4 5 has a support of 3 because 1 2 4 5 appears in three transactions.
The rule 1 ==> 2 4 5 has a confidence of 0.75 because 1 2 4 5 appears in three transactions and 1 appears in four transactions. Thus 3 / 4 = 0.75.
Hope this helps.