Confidence refers to how often the right-hand side of the apriori expression is valid when the left-hand side is valid. For instance, given an expression:
{Milk} à {Bread}
We would like to know how often Bread was purchased when Milk was also purchased.
In this case:
- Transaction 1: Milk and Bread are both present
- Transaction 2: Milk is present, but not Bread
- Transactions 3 and 4: Milk is not present
Hence, based on the what we saw, there were 2 transactions where Milk was present and of them, Bread was present in 1 transaction. Hence, the confidence for the rule {Milk} à {Bread} would be ½ = 50%
Taking another expression:
{Bread} à {Butter}
We would like to know, when Bread was purchased, how often was Butter also purchased?:
- Transaction 1: Bread and Butter are both present
- Transaction 2: There is no Bread (Butter is present, but our point of reference is Bread and hence this does not count)
- Transaction 3: Bread is present but no Butter
- Transaction 4: Bread and Butter are both present
Hence, we have Bread in 3 of the transactions, and Bread & Butter in 2 of the 3 transactions. Hence, in this case, the 'confidence' of the rule {Bread} à {Butter} is 2/3 = 66.7.