Get startedGet started for free

Visualizing itemset support

A content-streaming start-up has approached you for consulting services. To keep licensing fees low, they want to assemble a narrow library of movies that all appeal to the same audience. While they'll provide a smaller selection of content than the big players in the industry, they'll also be able to offer a low subscription fee.

You decide to use the MovieLens data and a heatmap for this project. Using a simple support-based heatmap will allow you to identify individual titles that have high support with other titles. The one-hot encoded data is available as the DataFrame onehot. Additionally, pandas is available as pd, seaborn is available as sns, and apriori() and association_rules() have both been imported.

This exercise is part of the course

Market Basket Analysis in Python

View Course

Hands-on interactive exercise

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

# Compute frequent itemsets using a minimum support of 0.07
frequent_itemsets = apriori(onehot, min_support = ____, 
                            use_colnames = True, max_len = 2)

# Compute the association rules
rules = association_rules(____, metric = 'support', 
                          min_threshold = 0.0)
Edit and Run Code