Business
Analytics Project
Group Members:
Aakarshak A Kavimane (MBA21002)
Bhumika Tarachandani (MBA21042)
Gunjan (MBA21067)
Sai Notham Konapala (MBA21171)
Yash Shandilya (MBA21245)
Market Basket Analysis
•Market basket analysis helps to discover association between items.
To Identify relation between items which are bought together.
•Association rule is used to analyze basket and to find association
between items.
•Association rule has following three measures to decide degree
of confidence:
• Support
•Confidence
•Lift
•Support: This helps to determine how frequently an item/itemset occurs
in the transaction as a percentage of all items.
Support = No of transactions in which A and B occurs
Total no of transactions
Market Basket Analysis
•Confidence : Ratio of Transactions that include an itemset say A and B to
the total no of transactions that include item A.
Confidence = No. of transactions in which A and B occurs
No. of transactions in which A occurs
•Confidence helps to find out no of transaction in which A and B are bought
together to the total no of transactions in which A occurs.
•Lift: Lift ratio is the ratio of confidence to expected confidence. It tells us
how much better a rule is at predicting the result than just assuming the
result in the first place. Greater lift values indicate stronger associations.
Lift = Support
Support(A) * Support(B)
Similarity between Bayes theorem
and Market basket analysis
•Arules package contains the important
functions such
Arules and Arules as apriori, itemFrequency which are important
for the market basket analysis
Viz packages
•ArulesViz package enables visualizing
association rules and frequent itemsets
•Plot function in arulesViz package is used to
visualize the association rules
Explanation of the Code
•Item Frequency() shows you the numbers themselves (what fraction of the carts have the item). It gives the prior
probability of finding a particular item in the cart.
•Market Basket analysis will tell us how the probability changes once we know details about cart composition.
•For MBA , we use apriori algorithm.
1. minimum length of 2 (one item in the "if" part and one item in the then part)
2. maximum length of 4 (three items in the "if" part and one item in the "then" part)
3. Support of at least 0.001 (at least 0.1% of carts must contain all items involved in the rule)
4. Confidence of at least 80% (of the carts that contain the items in the "if" part of the rule , at least 80% also have
the item in the "then" part, I.e., the rule is correct for at least 80% of the carts)
Explanation of the Code
•Inspect () is used to see rules object.
•Count – no of baskets that satisfy the rule
•Support – fraction of baskets that satisfy rule.
•Confidence – posterior probability that cart has item on RHS given it has all items on LHS of rule
•Coverage – fraction of baskets that have all items in LHS of rule.
•Lift: how many times more likely that item in RHS appear in a cart when it contains all items in LHS.
Item Frequency(Groceries)["bottled beer"]*11.2
Explanation of the Code
•We visualized the rules with the help of plot functio
•Plot(rules, method="graph", engine="htmlwidget")
•We can also check the relationship between different
items using the dropbox.
Arrows pointing to rule are items in the LHS("if"),
arrow leaving the rule point to the item in the
RHS("then"). Also, by clicking on the rules we can check
the support, confidence, coverage and lift.
Thank you