Permalink
Browse files

バグ修正

  • Loading branch information...
1 parent 1a265ed commit 41f21d9e787740e494d16188148932fa6957ba03 @mtkn-misty mtkn-misty committed May 19, 2013
Showing with 20 additions and 0 deletions.
  1. +20 −0 Chapter6/mails_word_bascket.r
@@ -0,0 +1,20 @@
+library(tm)
+library(arules)
+
+in_data <- read.csv("inbox_txt_data_enron.csv", header=TRUE, sep=",")
+
+terms_list <- as.list(NULL)
+for (i in 1:length(in_data$body)){
+ source <- VectorSource(in_data$body[i])
+ corpus <- Corpus(source)
+ matrix <- TermDocumentMatrix(corpus, control = list(stopwords = TRUE, removeNumbers = TRUE, removePunctuation = TRUE))
+ terms_list <- c(terms_list, list(matrix$dimnames$Terms))
+}
+
+tran <- as(terms_list, "transactions")
+in_ap <- apriori(tran, parameter = list(support=0.03,confidence=0.05, maxlen=3))
+
+inspect(head(sort(subset(in_ap, subset = lhs %pin% "bankruptcy"), by = "support"),n=20))
+inspect(head(sort(subset(in_ap, subset = lhs %pin% "pge"), by = "support"),n=20))
+inspect(head(sort(subset(in_ap, subset = lhs %pin% "crisis"), by = "support"),n=20))
+inspect(head(sort(subset(in_ap, subset = lhs %pin% "edison"), by = "support"),n=20))

0 comments on commit 41f21d9

Please sign in to comment.