_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 郁焔

Contents

1 Multi-Dimension Association Rule
2 Single-Dimension Association Rule
3 ル碁(Interestingness measure)
4 語 ル碁´り 螳?
5 R
6 谿瑚襭


1 Multi-Dimension Association Rule #


age(X, "20...29") ^ income(X, "20K...29K") => buys(X, "CD Player")
[讌讌= 2%, 襤磯= 60%]

  • 願 20~29語願, 20000 ~ 29000 螻螳譴 2%螳 CD伎企ゼ 蟲朱, 蠏碁9 螻螳 CD伎企ゼ 蟲襷ろ 襯 60%企.
  • age, income, buys 郁煙 譯朱. (Multi-Dimension Association Rule)

2 Single-Dimension Association Rule #


contains(T, "Computer") => Contains(T, "Software")
[讌讌= 1%, 襤磯= 50%]

  • 覈 蟇磯譴 1% Computer Software襯 覈 蟲襷ろ朱, 蟇磯 T螳 Computer襯 る 蠏 蟇磯螳 Software 襯 50%企.
  • 企朱 ( ) 覦覲給. (Single-Dimension Association Rule)



3 ル碁(Interestingness measure) #


讌讌(Support)
  • る: 蠏豺 伎 蟯螻 一危 れ 覦焔

    • support( A => B ) = P( A 蟲讌 B ) = 覈 螳 蟇磯 / 豌願碓
    • 豌願碓 譴 A B螳 蟇磯 觜

襤磯(confiednce)
  • る: 蠏豺 蟯 豢

    • confidence( A => B ) = P( B | A ) = 覈 螳 蟇磯 / 覈A 蟇磯
    • A 蟇磯譴 B螳 蟇磯 觜

レ(Lift)
  • る: 覈螳 蟯 炎鴬

    • lift( A => B ) = P( B | A ) / P( B ) = 覈A 蟇磯譴 覈B螳 蟇磯 觜 / 豌願碓 譴 覈B螳 蟇磯 觜
    • 覈 B螳 A 蟲襷る 蟆曙(襤磯) B豌企 蟲襷る 蟆曙一 觜
 if(lift == 1) 
	result = "A B螳 襦 襴曙 蟯螻(: 螻殊, 豢)"
else if(lift > 1)
	result = "A B螳 襦  蟯螻(:觜, 覯)"
else if(lift < 1)
	result = "A B螳 襦  蟯螻(: 讌, 覲觜)"

4 語 ル碁´り 螳? #

  • 豕讌讌 螻螳(minimum support threshold)
  • 豕襤磯 螻螳(minimum confidence threshold)

IF(豕讌讌 螻螳 == "襷譟" AND 豕襤磯 螻螳 == "襷譟")
	Result = "ル碁"
ELSE
	Result = "ル碁´讌"

  • 豕讌讌 螻螳螻 豕襤磯 螻螳 襷譟燕 蠏豺 螳(strong) 蠏豺企手 .
  • 螻豺 蟆一 企豪殊 覓瑚れ 蟆一.

5 R #

り 譬 伎..R襦 蟾 覓 襴. SSAS data mining朱 伎 蟆.


http://prdeepakbabu.wordpress.com/2010/11/13/market-basket-analysisassociation-rule-mining-using-r-package-arules/
transaction.csv
===========
1001,Choclates
1001,Pencil
1001,Marker
1002,Pencil
1002,Choclates
1003,Pencil
1003,Coke
1003,Eraser
1004,Pencil
1004,Choclates
1004,Cookies
1005,Marker
1006,Pencil
1006,Marker
1007,Pencil
1007,Choclates

#install.packages("arules")
library("arules")

tr = read.transactions(file="c:\\rdata\\transaction.csv", rm.duplicates= FALSE, format="single",sep="," ,cols =c(1,2));
basket_rules <- apriori(tr,parameter = list(sup = 0.5, conf = 0.9,target="rules"))
inspect(basket_rules)

rules.sorted <- sort(basket_rules, by="lift")
inspect(rules.sorted)

#install.packages("arulesViz")
library(arulesViz)
plot(basket_rules)
plot(basket_rules, method="graph", control=list(type="items"))
plot(basket_rules, method="paracoord", control=list(reorder=TRUE))


r <- sqlQuery(conn, "
select tid, items
from trnsaction_table
")

r.u <- unique(r)
head(r.u)
r.u <- sapply(r.u, unique)
names(r.u) <- paste("Tr", 1:length(r.u), sep="")

str(r.u)
ru.tr <- as(r.u, "transactions")

rules <- apriori(ru.tr, 
         parameter = list(supp = 0.5, conf = 0.9,
         target = "rules"))
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

蠏碁所 ロ 讌 襷 碁襯 襴糾 襷 . (れ梗)