Section 1. Chapter 3
single
Challenge: Manually Calculating Association Rules on Sample Ledgers
Swipe to show menu
Task
Swipe to start coding
Given a sample transaction ledger, your task is to manually compute support, confidence, and lift for specified item pairs using Python code.
- Calculate the support of the pair (
item_a,item_b) as the proportion of transactions containing both items. - Calculate the confidence of the rule
item_a → item_bas the proportion of transactions withitem_athat also containitem_b. - Calculate the lift of the rule as the confidence divided by the support of
item_b.
Solution
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 3
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat