Besides listing rules as text, you can visualize association rules, making it easier to find the relationship between itemsets. In the following recipe, we will introduce how to use the arulesViz
package to visualize the association rules.
In this recipe, we will continue using the Groceries
dataset. You need to have completed the previous recipe by generating the pruned rule rules.pruned
.
Perform the following steps to visualize the association rule:
- First, you need to install and load the
arulesViz
package:
> install.packages("arulesViz")> library(arulesViz)
- You can then make a scatter plot from the pruned rules:
> plot(rules.pruned)
The scatter plot of pruned association rules
- Additionally, to prevent overplotting, you can add jitter to the scatter plot:
> plot(rules.pruned, shading="order", control=list(jitter=6))
The scatter plot of pruned association rules with jitters
- We then produce new rules with
soda
on...