Analisis Keranjang Belanja di R
Christopher Bruffaerts
Statistician
Aturan dari Toko Kelontong
library(arules)
rules = apriori(data_trx,
parameter = list(
supp = 3/7, conf=0.6, minlen=2)
)
inspect(rules)
Tabel interaktif
library(arulesViz)
inspectDT(rules)
Tabel HTML
Inspeksi aturan
inspect(rules)
lhs rhs support confidence lift count
[1] {Bread} => {Butter} 0.4285714 1.0000000 1.1666667 3
[2] {Cheese} => {Wine} 0.4285714 0.7500000 1.0500000 3
[3] {Wine} => {Cheese} 0.4285714 0.6000000 1.0500000 3
[4] {Cheese} => {Butter} 0.4285714 0.7500000 0.8750000 3
[5] {Wine} => {Butter} 0.5714286 0.8000000 0.9333333 4
[6] {Butter} => {Wine} 0.5714286 0.6666667 0.9333333 4
Scatter plot dari arulesViz
plot(rules)

Opsi plot
plot(rulesObject, measure, shading, method)
rulesObject: objek aturan yang akan diplotmeasure: Ukuran ketertarikan aturan (support, confidence, lift, ...)shading: Ukuran untuk mewarnai titikmethod: Metode visualisasi yang digunakan ("scatterplot", "matrix", "two-key plot", "matrix3D")Contoh
plot(rules, measure = c("confidence", "lift"),
shading = "support",
method = "scatterplot")

Plot two-key
plot(rules, method = "two-key plot")

Tanpa jitter
plot(rules, method = "two-key plot")

Dengan jitter
plot(rules, method = "two-key plot",jitter = 2)

Aturan interaktif
plot(rules, engine = "plotly")
Dari statis ke interaktif

Analisis Keranjang Belanja di R