Exercise 11: Problem solved: Data Mining

 

code for exercise :

#a
library(arules)
data(Groceries)
Groceries

#b
myrules=apriori(Groceries)
inspect(myrules)

#c
myrules=apriori(Groceries,parameter=list(supp=0.05,conf=0.05))

#d
inspect(myrules)
myrules=apriori(Groceries,parameter=list(minlen=2))

#e
myrules=apriori(Groceries,parameter=list(minlen=1))
inspect(myrules)

#f
myrules=apriori(Groceries,parameter=list(supp=0.01,conf=0.01,minlen=3))

#g
inspect(myrules[20])
#answer lift value: Used to judge the strength of the association rule 
#if lift value is greater than> 1 some usefulness in that rule
#the larger the lift is the greater is the strength of the association
#https://www.dataminingapps.com/2017/04/what-is-the-lift-value-in-association-rule-mining/

#h
cc=sort(myrules,by="lift")
inspect(cc[1:10])

#i
hh=subset(myrules,subset=lhs %pin% "pork" & lift>1.2) #pin is using as matching function to match character
inspect(hh)

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.