Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. install.packages("e1071", dependencies = T)
  2. library(e1071)
  3. anatel <- read_csv("anatel.csv", locale = locale(encoding = "ISO-8859-1"))
  4. amostra <- sample(2,454, replace = T, prob = c(0.7, 0.3))
  5. anatelTreino <- anatel[amostra == 1,]
  6. anatelteste <- anatel[amostra ==2,]
  7. dim(anatelTreino)
  8. dim(anatelteste)
  9. modelo <- naiveBayes(Condicao ~ GrupoEconNorm + CanalEntrada + Tipo + Servico + Modalidade + Motivo, anatelTreino)
  10.  
  11. predicao <- predict(modelo, anatelteste, type='raw')
  12. predicao
  13. confusao <- table(anatelteste$Condicao, predicao)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement