Dari aturan ke visualisasi berbasis graf

Analisis Keranjang Belanja di R

Christopher Bruffaerts

Statistician

Memvisualisasikan aturan

Aturan interaktif

rules_html = plot(rules, method = "graph",
                  engine = "htmlwidget")
rules_html

Simpan widget HTML

library(htmlwidgets)
saveWidget(rules_html, file = "rules_grocery.html")

graf_aturan

Analisis Keranjang Belanja di R

Memilih item dan aturan dari graf

Pilih item Bread

graf_aturan_roti

Pilih Aturan 3

graf_aturan3

Analisis Keranjang Belanja di R

Graf dan subgraf (1)

Urutkan aturan menurut confidence

top4subRules = 
    head(sort(rules, by = "confidence"), 4)
inspect(top4subRules)
    lhs         rhs      support   confidence lift      count
[1] {Bread}  => {Butter} 0.4285714 1.00       1.1666667 3    
[2] {Wine}   => {Butter} 0.5714286 0.80       0.9333333 4    
[3] {Cheese} => {Wine}   0.4285714 0.75       1.0500000 3    
[4] {Cheese} => {Butter} 0.4285714 0.75       0.8750000 3

Plot aturan dengan confidence tinggi

plot(top4subRules, method = "graph",  engine = "htmlwidget")

graf_aturan_confidence

Analisis Keranjang Belanja di R

Graf dan subgraf (2)

Periksa aturan tentang Cheese

C_rules = 
    apriori(data = data_trx, 
            parameter = list(supp = 3/7,
                             conf = 0.2,
                             minlen = 2),
            appearance = list(rhs = "Cheese"))
inspect(C_rules)
    lhs         rhs      support   confidence lift  count
[1] {Wine}   => {Cheese} 0.4285714 0.6        1.050 3    
[2] {Butter} => {Cheese} 0.4285714 0.5        0.875 3

Plot aturan tentang Cheese

plot(C_rules, method = "graph",  engine = "htmlwidget")

graf_aturan_cheese

Analisis Keranjang Belanja di R

Simpan sebagai Graph

Simpan graf Anda

saveAsGraph(rules, file = "rules.graphml")
Analisis Keranjang Belanja di R

Mari membuat aturan!

Analisis Keranjang Belanja di R

Preparing Video For Download...