Modeling and evaluation

We'll start by mining the data for the overall association rules before moving on to our rules for beer specifically. Throughout the modeling process, we'll use the apriori algorithm, which is the appropriately named apriori() function in the arules package. The two main things that we'll need to specify in the function are the dataset and parameters. As for the parameters, you'll need to apply judgment when determining the minimum support, confidence, and the minimum and/or maximum length of basket items in an itemset. Using item frequency plots, along with trial and error, let's set the minimum support at 1 in 1,000 transactions and the minimum confidence at 90 %.

Additionally, let's establish the maximum number ...

Get Mastering Machine Learning with R - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.