1. Learn
  2. /
  3. Courses
  4. /
  5. Market Basket Analysis in Python

Exercise

Computing conviction

After hearing about the useful advice you provided to the library, the founder of a small ebook selling start-up approaches you for consulting services. As a test of your abilities, she asks you if you are able to compute conviction for the rule {Potter} \(\rightarrow\) {Hunger}, so she can decide whether to place the books next to each other on the company's website. Fortunately, you still have access to the goodreads-10k data, which is available as books. Additionally, pandas has been imported as pd and numpy as np.

Instructions

100 XP
  • Compute the support for {Potter} and assign it to supportP.
  • Compute the support for NOT {Hunger}.
  • Compute the support for {Potter} and NOT {Hunger}.
  • Complete the expression for the conviction metric in the return statement.