Mining associations with the Apriori rule
Association mining is a technique that can discover interesting relationships hidden in a transaction dataset. This approach first finds all frequent itemsets and generates strong association rules from frequent itemsets. In this recipe, we will introduce how to perform association analysis using the Apriori rule.
Getting ready
Ensure you have completed the previous recipe by generating transactions and storing these in a variable, trans
.
How to do it…
Please perform the following steps to analyze association rules:
Use
apriori
to discover rules with support over0.001
and confidence over0.1
:> rules <- apriori(trans, parameter = list(supp = 0.001, conf = 0.1, target= "rules")) > summary(rules) set of 6 rules rule length distribution (lhs + rhs):sizes 2 6 Min. 1st Qu. Median Mean 3rd Qu. Max. 2 2 2 2 2 2 summary of quality measures: support confidence lift...