Phân tích giỏ hàng trong R
Christopher Bruffaerts
Statistician
Trích xuất luật
rules = apriori(Groceries,
parameter = list(
supp=.001,
conf=.5,
minlen=2,
target='rules'
))
# Kiểm tra bằng datatable
inspectDT(rules)
Bảng HTML
Biểu đồ từ arulesViz
# Vẽ luật dạng scatterplot
plot(rules, method = "scatterplot",
engine = "html")
Các kiểu biểu đồ khác với method:
Scatterplot và khác
Engine và method
# Vẽ luật dạng đồ thị
plot(rules, method = "graph",
engine = "html")
Sắp xếp các luật đã trích xuất
# Top 10 luật có độ tin cậy cao nhất
top10_rules_Groceries =
head(sort(rules,by = "confidence"), 10)
inspect(top10_rules_Groceries)
# Vẽ top 10 luật
plot(top10_rules_Groceries,
method = "graph", engine = "html")
rules = apriori(Groceries, parameter=list(supp=0.001, conf=0.8))
ruleExplorer(rules)
Phân tích giỏ hàng trong R