SlideShare a Scribd company logo
1 of 16
Market Basket Analysis-
Implementation using R
Submitted By:Yogesh KhandelwalGuided By:Prof.Avinash Navlani
What is Association Rule Mining?
• Affinity analysis and association rule
learning encompasses a broad set of analytics
techniques aimed at uncovering the
associations and connections between specific
objects these might be
• visitors to your website (customers or audience),
• products in your store,
• content items on your media site
• Product recommendation on e-commerce website.
Market Basket Analysis?
• “market basket analysis” is one of the most
famous application of Association rule mining.
• In a market basket analysis, you look to see if
there are combinations of products that
frequently co-occur in transactions.
– For example, maybe people who buy flour and casting sugar,
also tend to buy eggs (because a high proportion of them are
planning on baking a cake).
Importance of performing MBA
• A retailer can use this information:
– Store layout (put products that co-occur together close to one
another, to improve the customer shopping experience)
– Marketing (e.g. target customers who buy flour with offers on
eggs, to encourage them to spend more on their shopping
basket)
• Online retailers and publishers can use this type
of analysis to:
– Inform the placement of content items on their media sites, or
products in their catalogue
– Drive recommendation engines (like Amazon’s customers who
bought this product also bought these products…)
– Deliver targeted marketing (e.g. emailing customers who bought
products specific products with other products and offers on
those products that are likely to be interesting to them.)
Some Mathematical terminology
• Support: The fraction of which our item set
occurs in our dataset.
X->Y
pr(xUy)
• Confidence: probability that a rule is correct
for a new transaction with items on the left.
pr(y|x)
Impelmentation using R
• It is assumed that reader has prior basic
knowledge of Association rule mining,apriori
algorithm etc.
• Packages we will use:
• Arules
• Arulesviz
Know your dataset
• Dataset used:
– Groceries(data is inbuilt in arule package)
– Also it can be downloaded
from:(Source:http://www.salemmarafi.com/wp-
content/uploads/2014/03/groceries.csv)
# Transaction in Input data 9835
# Columns in input data 32
# Items in input data 169
Lets start by loading packages &
datasets
Top 25 Frequent product
Mine some rules!!
• We need to provide min.support and min. confidence
Output:
If someone buys yogurt
and cereals, they are 81%
likely to buy whole milk
too.
Cont..
• We can get the summary report by using
• Summary(rules)
Sorting Stuff out
The first issue we see here is that the rules are not sorted. Often we will want the
most relevant rules first. Lets say we wanted to have the most likely rules. We can
easily sort by confidence by executing the following code.
Before Sorting
After Sorting
Redundancies!!
• Sometimes, rules will repeat. Redundancy indicates that one item might be a
given. As an analyst you can elect to drop the item from the dataset. Alternatively,
you can remove redundant rules generated.
• We can remove the redundancy by following rule:
 subset.matrix <- is.subset(rules, rules)
 subset.matrix[lower.tri(subset.matrix, diag=T)] <- NA
 redundant <- colSums(subset.matrix, na.rm=T) >= 1
 rules.pruned <- rules[!redundant]
 rules<-rules.pruned
Targeting Items
• There are two types of Target we might be intrested:
• What are customers likely to buy before buying whole milk
• What are customers likely to buy if they purchase whole milk?
Visualization
What Next??
• Association rule is applicable to many area
like:
• Twitter Analysis
• Medical Analysis
• Etc.
• Thank You
• Sources:http://www.salemmarafi.com/code/market-basket-analysis-with-r/comment-page-1/
• http://www.analyticsvidhya.com/blog/2014/08/visualizing-market-basket-analysis/
• http://snowplowanalytics.com/analytics/catalog-analytics/market-basket-analysis-identifying-products-
that-sell-well-together.html
• Rdatamining.com

More Related Content

What's hot

What's hot (20)

Anomaly detection (Unsupervised Learning) in Machine Learning
Anomaly detection (Unsupervised Learning) in Machine LearningAnomaly detection (Unsupervised Learning) in Machine Learning
Anomaly detection (Unsupervised Learning) in Machine Learning
 
Collaborative Filtering Recommendation System
Collaborative Filtering Recommendation SystemCollaborative Filtering Recommendation System
Collaborative Filtering Recommendation System
 
Machine learning
Machine learningMachine learning
Machine learning
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine Learning
 
Data mining
Data miningData mining
Data mining
 
Supervised and unsupervised learning
Supervised and unsupervised learningSupervised and unsupervised learning
Supervised and unsupervised learning
 
Rules of data mining
Rules of data miningRules of data mining
Rules of data mining
 
Ensemble learning
Ensemble learningEnsemble learning
Ensemble learning
 
Fp growth algorithm
Fp growth algorithmFp growth algorithm
Fp growth algorithm
 
Social Network Analysis
Social Network AnalysisSocial Network Analysis
Social Network Analysis
 
Data Mining: Text and web mining
Data Mining: Text and web miningData Mining: Text and web mining
Data Mining: Text and web mining
 
Machine Learning Contents.pptx
Machine Learning Contents.pptxMachine Learning Contents.pptx
Machine Learning Contents.pptx
 
Clustering in Data Mining
Clustering in Data MiningClustering in Data Mining
Clustering in Data Mining
 
Recommendation System Explained
Recommendation System ExplainedRecommendation System Explained
Recommendation System Explained
 
Recommendation system
Recommendation system Recommendation system
Recommendation system
 
Web mining
Web miningWeb mining
Web mining
 
Association Rule.ppt
Association Rule.pptAssociation Rule.ppt
Association Rule.ppt
 
web mining
web miningweb mining
web mining
 
Classification by back propagation, multi layered feed forward neural network...
Classification by back propagation, multi layered feed forward neural network...Classification by back propagation, multi layered feed forward neural network...
Classification by back propagation, multi layered feed forward neural network...
 
Big Data & Text Mining
Big Data & Text MiningBig Data & Text Mining
Big Data & Text Mining
 

Viewers also liked

Data mining- Association Analysis -market basket
Data mining- Association Analysis -market basketData mining- Association Analysis -market basket
Data mining- Association Analysis -market basket
Swapnil Soni
 
I.liiv gaining shopper_insights_using_market_basket_analysis
I.liiv gaining shopper_insights_using_market_basket_analysisI.liiv gaining shopper_insights_using_market_basket_analysis
I.liiv gaining shopper_insights_using_market_basket_analysis
ECR Community
 
Market Basket Analysis
Market Basket AnalysisMarket Basket Analysis
Market Basket Analysis
Olaseni Fadipe
 
Review of a paper on market basket analysis
Review of a paper on market basket analysisReview of a paper on market basket analysis
Review of a paper on market basket analysis
Dev Karan Singh Maletia
 
Product recommendation for Santander Bank customers
Product recommendation for Santander Bank customersProduct recommendation for Santander Bank customers
Product recommendation for Santander Bank customers
Sumit Saini
 
PhD Thesis: Mining abstractions in scientific workflows
PhD Thesis: Mining abstractions in scientific workflowsPhD Thesis: Mining abstractions in scientific workflows
PhD Thesis: Mining abstractions in scientific workflows
dgarijo
 
Real-time Market Basket Analysis for Retail with Hadoop
Real-time Market Basket Analysis for Retail with HadoopReal-time Market Basket Analysis for Retail with Hadoop
Real-time Market Basket Analysis for Retail with Hadoop
DataWorks Summit
 

Viewers also liked (20)

Market Basket Analysis
Market Basket AnalysisMarket Basket Analysis
Market Basket Analysis
 
Data mining- Association Analysis -market basket
Data mining- Association Analysis -market basketData mining- Association Analysis -market basket
Data mining- Association Analysis -market basket
 
Market basket analysis
Market basket analysisMarket basket analysis
Market basket analysis
 
Data Science - Part VI - Market Basket and Product Recommendation Engines
Data Science - Part VI - Market Basket and Product Recommendation EnginesData Science - Part VI - Market Basket and Product Recommendation Engines
Data Science - Part VI - Market Basket and Product Recommendation Engines
 
I.liiv gaining shopper_insights_using_market_basket_analysis
I.liiv gaining shopper_insights_using_market_basket_analysisI.liiv gaining shopper_insights_using_market_basket_analysis
I.liiv gaining shopper_insights_using_market_basket_analysis
 
Market Basket Analysis
Market Basket AnalysisMarket Basket Analysis
Market Basket Analysis
 
Review of a paper on market basket analysis
Review of a paper on market basket analysisReview of a paper on market basket analysis
Review of a paper on market basket analysis
 
Santander
SantanderSantander
Santander
 
Market Basket Analysis in SAS
Market Basket Analysis in SASMarket Basket Analysis in SAS
Market Basket Analysis in SAS
 
Transactions / Basket Analysis
Transactions / Basket AnalysisTransactions / Basket Analysis
Transactions / Basket Analysis
 
Product recommendation for Santander Bank customers
Product recommendation for Santander Bank customersProduct recommendation for Santander Bank customers
Product recommendation for Santander Bank customers
 
PhD Thesis: Mining abstractions in scientific workflows
PhD Thesis: Mining abstractions in scientific workflowsPhD Thesis: Mining abstractions in scientific workflows
PhD Thesis: Mining abstractions in scientific workflows
 
Mining Fuzzy Moving Object Clusters
Mining Fuzzy Moving Object ClustersMining Fuzzy Moving Object Clusters
Mining Fuzzy Moving Object Clusters
 
PhD Defense -- Ashish Mangalampalli
PhD Defense -- Ashish MangalampalliPhD Defense -- Ashish Mangalampalli
PhD Defense -- Ashish Mangalampalli
 
Python programming advance lab api npr 2
Python programming advance lab api npr  2Python programming advance lab api npr  2
Python programming advance lab api npr 2
 
26 Machine Learning Unsupervised Fuzzy C-Means
26 Machine Learning Unsupervised Fuzzy C-Means26 Machine Learning Unsupervised Fuzzy C-Means
26 Machine Learning Unsupervised Fuzzy C-Means
 
Market Basket Analysis in SAS
Market Basket Analysis in SASMarket Basket Analysis in SAS
Market Basket Analysis in SAS
 
Market analysis and the buying behavior of buyers of paper industry
Market analysis and the buying behavior of  buyers of paper industryMarket analysis and the buying behavior of  buyers of paper industry
Market analysis and the buying behavior of buyers of paper industry
 
Masket Basket Analysis
Masket Basket AnalysisMasket Basket Analysis
Masket Basket Analysis
 
Real-time Market Basket Analysis for Retail with Hadoop
Real-time Market Basket Analysis for Retail with HadoopReal-time Market Basket Analysis for Retail with Hadoop
Real-time Market Basket Analysis for Retail with Hadoop
 

Similar to Market basketanalysis using r

Association Rule Mining with Apriori Algorithm.pptx
Association Rule Mining with Apriori Algorithm.pptxAssociation Rule Mining with Apriori Algorithm.pptx
Association Rule Mining with Apriori Algorithm.pptx
AnjumaaraAnsari
 
2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules
FEG
 
EMI & Traceability – Maintaining Quality, Safety and Compliance
EMI & Traceability – Maintaining Quality, Safety and ComplianceEMI & Traceability – Maintaining Quality, Safety and Compliance
EMI & Traceability – Maintaining Quality, Safety and Compliance
Northwest Analytics
 
Types of Machine Learning- Tanvir Siddike Moin
Types of Machine Learning- Tanvir Siddike MoinTypes of Machine Learning- Tanvir Siddike Moin
Types of Machine Learning- Tanvir Siddike Moin
Tanvir Moin
 
14 CREATING A GROUP AND RUNNING A PROJECTIn this chapter, we wil.docx
14 CREATING A GROUP AND RUNNING A PROJECTIn this chapter, we wil.docx14 CREATING A GROUP AND RUNNING A PROJECTIn this chapter, we wil.docx
14 CREATING A GROUP AND RUNNING A PROJECTIn this chapter, we wil.docx
aulasnilda
 

Similar to Market basketanalysis using r (20)

Market Basket Analysis.pptx
Market Basket Analysis.pptxMarket Basket Analysis.pptx
Market Basket Analysis.pptx
 
big data seminar.pptx
big data seminar.pptxbig data seminar.pptx
big data seminar.pptx
 
What is FP Growth Analysis and How Can a Business Use Frequent Pattern Mining...
What is FP Growth Analysis and How Can a Business Use Frequent Pattern Mining...What is FP Growth Analysis and How Can a Business Use Frequent Pattern Mining...
What is FP Growth Analysis and How Can a Business Use Frequent Pattern Mining...
 
Unit 4_ML.pptx
Unit 4_ML.pptxUnit 4_ML.pptx
Unit 4_ML.pptx
 
Market Basket Analysis of bakery Shop
Market Basket Analysis of bakery ShopMarket Basket Analysis of bakery Shop
Market Basket Analysis of bakery Shop
 
Supply Chain Management.ppt
Supply Chain Management.pptSupply Chain Management.ppt
Supply Chain Management.ppt
 
Data mining
Data miningData mining
Data mining
 
Products Frequently Bought Together in Stores Using classificat...
Products Frequently Bought Together in Stores               Using classificat...Products Frequently Bought Together in Stores               Using classificat...
Products Frequently Bought Together in Stores Using classificat...
 
Association Rule Mining with Apriori Algorithm.pptx
Association Rule Mining with Apriori Algorithm.pptxAssociation Rule Mining with Apriori Algorithm.pptx
Association Rule Mining with Apriori Algorithm.pptx
 
Instacart Market Basket Analysis
Instacart Market Basket AnalysisInstacart Market Basket Analysis
Instacart Market Basket Analysis
 
CHAPTER 2.ppt
CHAPTER 2.pptCHAPTER 2.ppt
CHAPTER 2.ppt
 
2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules2023 Supervised_Learning_Association_Rules
2023 Supervised_Learning_Association_Rules
 
EMI & Traceability – Maintaining Quality, Safety and Compliance
EMI & Traceability – Maintaining Quality, Safety and ComplianceEMI & Traceability – Maintaining Quality, Safety and Compliance
EMI & Traceability – Maintaining Quality, Safety and Compliance
 
Types of Machine Learning- Tanvir Siddike Moin
Types of Machine Learning- Tanvir Siddike MoinTypes of Machine Learning- Tanvir Siddike Moin
Types of Machine Learning- Tanvir Siddike Moin
 
Association and Classification Algorithm
Association and Classification AlgorithmAssociation and Classification Algorithm
Association and Classification Algorithm
 
Data warehousing
Data warehousingData warehousing
Data warehousing
 
Understanding the Lifecycle of a Data Analysis Project
Understanding the Lifecycle of a Data Analysis ProjectUnderstanding the Lifecycle of a Data Analysis Project
Understanding the Lifecycle of a Data Analysis Project
 
What goes with what (Market Basket Analysis)
What goes with what (Market Basket Analysis)What goes with what (Market Basket Analysis)
What goes with what (Market Basket Analysis)
 
A Practical Approach To Data Mining Presentation
A Practical Approach To Data Mining PresentationA Practical Approach To Data Mining Presentation
A Practical Approach To Data Mining Presentation
 
14 CREATING A GROUP AND RUNNING A PROJECTIn this chapter, we wil.docx
14 CREATING A GROUP AND RUNNING A PROJECTIn this chapter, we wil.docx14 CREATING A GROUP AND RUNNING A PROJECTIn this chapter, we wil.docx
14 CREATING A GROUP AND RUNNING A PROJECTIn this chapter, we wil.docx
 

Recently uploaded

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Recently uploaded (20)

Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 

Market basketanalysis using r

  • 1. Market Basket Analysis- Implementation using R Submitted By:Yogesh KhandelwalGuided By:Prof.Avinash Navlani
  • 2. What is Association Rule Mining? • Affinity analysis and association rule learning encompasses a broad set of analytics techniques aimed at uncovering the associations and connections between specific objects these might be • visitors to your website (customers or audience), • products in your store, • content items on your media site • Product recommendation on e-commerce website.
  • 3. Market Basket Analysis? • “market basket analysis” is one of the most famous application of Association rule mining. • In a market basket analysis, you look to see if there are combinations of products that frequently co-occur in transactions. – For example, maybe people who buy flour and casting sugar, also tend to buy eggs (because a high proportion of them are planning on baking a cake).
  • 4. Importance of performing MBA • A retailer can use this information: – Store layout (put products that co-occur together close to one another, to improve the customer shopping experience) – Marketing (e.g. target customers who buy flour with offers on eggs, to encourage them to spend more on their shopping basket) • Online retailers and publishers can use this type of analysis to: – Inform the placement of content items on their media sites, or products in their catalogue – Drive recommendation engines (like Amazon’s customers who bought this product also bought these products…) – Deliver targeted marketing (e.g. emailing customers who bought products specific products with other products and offers on those products that are likely to be interesting to them.)
  • 5. Some Mathematical terminology • Support: The fraction of which our item set occurs in our dataset. X->Y pr(xUy) • Confidence: probability that a rule is correct for a new transaction with items on the left. pr(y|x)
  • 6. Impelmentation using R • It is assumed that reader has prior basic knowledge of Association rule mining,apriori algorithm etc. • Packages we will use: • Arules • Arulesviz
  • 7. Know your dataset • Dataset used: – Groceries(data is inbuilt in arule package) – Also it can be downloaded from:(Source:http://www.salemmarafi.com/wp- content/uploads/2014/03/groceries.csv) # Transaction in Input data 9835 # Columns in input data 32 # Items in input data 169
  • 8. Lets start by loading packages & datasets Top 25 Frequent product
  • 9. Mine some rules!! • We need to provide min.support and min. confidence Output: If someone buys yogurt and cereals, they are 81% likely to buy whole milk too.
  • 10. Cont.. • We can get the summary report by using • Summary(rules)
  • 11. Sorting Stuff out The first issue we see here is that the rules are not sorted. Often we will want the most relevant rules first. Lets say we wanted to have the most likely rules. We can easily sort by confidence by executing the following code. Before Sorting After Sorting
  • 12. Redundancies!! • Sometimes, rules will repeat. Redundancy indicates that one item might be a given. As an analyst you can elect to drop the item from the dataset. Alternatively, you can remove redundant rules generated. • We can remove the redundancy by following rule:  subset.matrix <- is.subset(rules, rules)  subset.matrix[lower.tri(subset.matrix, diag=T)] <- NA  redundant <- colSums(subset.matrix, na.rm=T) >= 1  rules.pruned <- rules[!redundant]  rules<-rules.pruned
  • 13. Targeting Items • There are two types of Target we might be intrested: • What are customers likely to buy before buying whole milk • What are customers likely to buy if they purchase whole milk?
  • 15. What Next?? • Association rule is applicable to many area like: • Twitter Analysis • Medical Analysis • Etc.
  • 16. • Thank You • Sources:http://www.salemmarafi.com/code/market-basket-analysis-with-r/comment-page-1/ • http://www.analyticsvidhya.com/blog/2014/08/visualizing-market-basket-analysis/ • http://snowplowanalytics.com/analytics/catalog-analytics/market-basket-analysis-identifying-products- that-sell-well-together.html • Rdatamining.com