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

Exercise

Promoting ebooks with conviction

In the previous exercise, we defined a function to compute conviction. We were asked to apply that function to all two-book permutations of the goodreads-10k dataset. In this exercise, we'll test the function by applying it to the three most popular books, which we used in earlier exercises: The Hunger Games, Harry Potter, and Twilight.

The function has been defined for you and is available as conviction. Recall that it takes an antecedent and a consequent as its two arguments. Additionally, the columns of the books DataFrame from earlier exercises are available as three separate DataFrames: potter, twilight, and hunger.

Instructions

100 XP
  • Compute conviction for {Twilight} \(\rightarrow\) {Potter} and {Potter} \(\rightarrow\) {Twilight}.
  • Compute conviction for {Twilight} \(\rightarrow\) {Hunger} and {Hunger} \(\rightarrow\) {Twilight}.
  • Compute conviction for {Potter} \(\rightarrow\) {Hunger} and {Hunger} \(\rightarrow\) {Potter}.