O'Reilly logo

Machine Learning with R Cookbook by Chiu Yu-Wei

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Visualizing association rules

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 aruleViz package to visualize the association rules.

Getting ready

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.

How to do it...

Perform the following steps to visualize the association rule:

  1. First, you need to install and load the package arulesViz:
    > install.packages("arulesViz")
    > library(arulesViz)
    
  2. You can then make a scatter plot from the pruned rules:
    > plot(rules.pruned)
    

    The scatter plot of pruned association rules

  3. Additionally, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required