library(arules)
library(arulesViz)
# file mbaper
library(arules)
library(arulesViz)
data1<-read.csv("file:///D:/1 Teaching Material/1 inurture Lectures/1 multivariate data analysis/1 Multivariate Data Analysis PPts Self/MBA/MBA- Main/data1.csv")
data3<-as(split(data1[,"product"],data1[,"tid"]), "transactions")
inspect(data3)
itemFrequencyPlot(data3,topN=20,type="absolute")
rules1 <- apriori(data3) # command to find all the apriori rules possible
rules2 <- apriori(data3, parameter = list(supp = 0.001, conf = 0.001)) # command to find all the apriori rules with support =0.001 and conf =0.8, it takes a long time
inspect(rules2)
sort(rules2, by ="confidence")
inspect(sort(rules2, by ="confidence"))
# Plot the Rules
library(arulesViz)
plot(rules2)
plot(rules1, method = "graph")
plot(rules1, method = "grouped")
plotly_arules(rules1)
#--------------------------------------------------
library(arulesViz)
plot(rules2,method="graph",interactive=FALSE,shading=NA)