Session Ready
Exercise

Generating association rules

In the final exercise of the previous section, you computed itemsets for the novelty gift store owner using the Apriori algorithm. You told the store owner that relaxing support from 0.005 to 0.003 increased the number of itemsets from 9 to 91. Relaxing it again to 0.001 increased the number to 429. Satisfied with the descriptive work you've done, the store manager asks you to identify some association rules from those two sets of frequent itemsets you computed.

Note that pandas has been imported for you as pd and the two frequent itemsets are available as frequent_itemset_1 and frequent_itemset_2. Your objective is to determine what association rules can be mined from these itemsets.

Instructions
100 XP
  • Import the algorithm from mlxtend that computes association rules from apriori algorithm results.
  • Complete the statement to compute association rules for frequent_itemsets_1 using the support metric and a threshold of 0.0015.
  • Complete the statement to compute association rules for frequent_itemsets_2 using the support metric and a threshold of 0.0015.