Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- install.packages("e1071", dependencies = T)
- library(e1071)
- anatel <- read_csv("anatel.csv", locale = locale(encoding = "ISO-8859-1"))
- amostra <- sample(2,454, replace = T, prob = c(0.7, 0.3))
- anatelTreino <- anatel[amostra == 1,]
- anatelteste <- anatel[amostra ==2,]
- dim(anatelTreino)
- dim(anatelteste)
- modelo <- naiveBayes(Condicao ~ GrupoEconNorm + CanalEntrada + Tipo + Servico + Modalidade + Motivo, anatelTreino)
- predicao <- predict(modelo, anatelteste, type='raw')
- predicao
- confusao <- table(anatelteste$Condicao, predicao)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement