-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteste2.R
31 lines (29 loc) · 820 Bytes
/
teste2.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
library(arules)
data()
data("Groceries")
dim(Groceries)
itemLabels(Groceries)
summary(Groceries)
itemFrequencyPlot(Groceries, topN=10)
rules <- apriori(Groceries, parameter = list(supp=0.1, conf=0.9, target= "rules"))
summary(rules)
market_basket <-
list(
c("apple", "beer", "rice", "meat"),
c("apple", "beer", "rice"),
c("apple", "beer"),
c("apple", "pear"),
c("milk", "beer", "rice", "meat"),
c("milk", "beer", "rice"),
c("milk", "beer"),
c("milk", "pear")
)
# set transaction names (T1 to T8)
names(market_basket) <- paste("T", c(1:8), sep = "")
trans <- as(market_basket, "transactions")
dim(trans)
itemLabels(trans)
summary(trans)
itemFrequencyPlot(trans, topN=10)
rules <- apriori(trans, parameter = list(supp=0.3, conf=0.5, maxlen=10, target= "rules"))
summary(rules)