Advertisement
Guest User

nkB

a guest
Mar 19th, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.52 KB | None | 0 0
  1.   library(e1071)
  2.   library(class)
  3.   library(kernlab)
  4.   data(spam)
  5.   rows <- sample.int(nrow(spam), size = round(nrow(spam)/3), replace = F)
  6.   spam.train <- spam[-rows,]
  7.   spam.test <- spam[rows,]
  8.   model.bayes <- naiveBayes(x = spam.train[,-58], y = spam.train[,58])
  9.   bayes.result <- predict(model.bayes, spam.test[,-58])
  10.   error.bayes <- 1 - sum(bayes.result == spam.test[,58])/length(spam.test[,58])
  11.   sum(bayes.result != spam.test[,58])/length(bayes.result)
  12.   as.numeric(bayes.result) - 1
  13.  
  14. kurwix nie wiem co dalej
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement