Marker Basket Analysis using Apriori algorithm

Project for Data Product Course

Tho Duy Nguyen

Traditional data analysis apply for retail store?

  • Quantity of each products
  • Quantity through time (seasonal effect)
  • Closed customer
  • More?

enough for effective marketting?

Modern requirment

  • Bigger and more complex information
  • Insight about beahavior customer?

"Pattern" in purchasing goods: How products are bought together?

Frequent pattern analysis using Apriori algorithm

  • Using transaction data (order detail)available on any sell-system
  • Package "arules" and "arulesViz" already on R
  • Simple concepts and easy to understand the analysis result.
  • Solution for "How products are bought together?"
  • Graphic visualization

Concepts

Association rules

  • A set of association rules that specify patterns of relationships among items
  • Ex: {peanut butter, jelly} => {bread}
  • Support(X) = count(X) / N
  • Confidience(X => Y) = Support(X, Y) / Support(X)

Implement

result <- apriori(data = data, parameter = list(support = 0.05, confidence = 0.05))
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport support minlen maxlen
##        0.05    0.1    1 none FALSE            TRUE    0.05      1     10
##  target   ext
##   rules FALSE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## apriori - find association rules with the apriori algorithm
## version 4.21 (2004.05.09)        (c) 1996-2004   Christian Borgelt
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[44 item(s), 10957 transaction(s)] done [0.00s].
## sorting and recoding items ... [13 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [15 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].

Visualization

plot(result, method="graph", control=list(type="items"))

plot of chunk unnamed-chunk-4