Get startedGet started for free

Picking the right movie parameters

You are still wondering how to decide which parameters to add in the apriori() function. In particular, you need to decide the thresholds to use for the minimum support, confidence or eventually lift measures. The parameters added to the apriori() function will have an impact on the set of movie rules we obtain. To help in deciding which parameters are most appropriate to obtain the set of movie rules, let's create a plot of the number of rules. In this exercise, you will create a plot to decide on the most appropriate combination of parameters to be used in the apriori() function.

This exercise is part of the course

Market Basket Analysis in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Set of confidence levels
confidenceLevels = seq(from=0.95, to=0.5, by=-0.05)

# Create empty vector
rules_sup04 = NULL

# Apriori algorithm with a support level of 40%
for (i in 1:length(___)) {
  rules_sup04[i] = 
  ___(apriori(movie_trx,
                 parameter=list(sup=___, 
                                conf=confidenceLevels[i],
                                target="___")))
}
Edit and Run Code