Get startedGet started for free

Visualizing transactions and rules

1. Visualizing transactions and rules

In the last lesson, we have extracted sets of rules from the transactional dataset. These were mostly rules displayed in dataframes or tables. The coolest part of the Market Basket Analysis is to visualize these sets of extracted rules. On top of producing nice plots, we will add the interactivity feature that will guide us through the movie recommendation. Let's put our artistic skills to work.

2. Interactive inspection

Remember that we're applying this example on the groceries dataset. After creating the set of rules, let's call the "inspectDT" function. It allows us to interactively filter and sort the set of extracted rules. It gives you the freedom to inspect the rules.

3. Interactive scatterplots

The "arulesViz" package is like a visualization toolbox for association rules. It contains many different types of plots that help you getting familiar with the set of extracted rules. Remember that setting the engine parameter to "HTML" makes the plot interactive. Other types of plots include the two-key plots, the grouped plot and the matrix. This can be all set by using the "method" argument of the plot function.

4. Interactive graphs

Two keywords to be used for interactive plots are: "engine" and "method". To display an interactive graph of the rules, set "graph" as "method" and "HTML" as "engine". This will generate an interactive graph which can be dragged, searched and saved as an HTML file. However, it often happens that there is too much information displayed on the graph. You should therefore think of subsetting rules to be displayed.

5. Interactive subgraphs

It can be the case that interactive graphs are unreadable. Even if they are interactive, there could be too many items and rules on graphs. You should think about subsetting the set of rules. In this example, we select the 10 rules with the highest confidence. This gives a subgraph of the graph we saw on the previous slide. It makes your life easier as you are now able to see what is happening.

6. RuleExploring Groceries

Putting everything together can be done with the shiny app. Just call "RuleExplorer" on the set of rules you created, you have the possibility to change parameters on the left hand side of the app. Be careful, changing parameters can result in long processing times. This is why the Shiny app is not always recommended when working with million of transactions. One advice would be to start with a small subset of rules and start playing around with the app before you use a much larger set of rules.

7. Let's visualize some movie rules!

Enough talking, let's create plots to get more insights about the Movie dataset.

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.