Guest User

Untitled

a guest
Mar 19th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. ### input ###
  2.  
  3. library(naivebayes)
  4. name <- c("candidate1", "candidate2", "candidate3")
  5. rank <- c(5, 1, 3)
  6. probability <- c(0.3, 0.7, 0.5)
  7. naive_bayes(rank, name, prior=probability)
  8.  
  9. ### output ###
  10.  
  11. ===================== Naive Bayes =====================
  12. Call:
  13. naive_bayes.default(x = rank, y = name, prior = probability)
  14.  
  15. A priori probabilities:
  16. candidate1 candidate2 candidate3
  17. 0.2000000 0.4666667 0.3333333
  18.  
  19. Tables:
  20.  
  21. x candidate1 candidate2 candidate3
  22. mean 5 1 3
  23. sd
  24.  
  25. naive_bayes(rank, name)
  26.  
  27. ===================== Naive Bayes =====================
  28. Call:
  29. naive_bayes.default(x = rank, y = name)
  30.  
  31. A priori probabilities:
  32.  
  33. candidate1 candidate2 candidate3
  34. 0.3333333 0.3333333 0.3333333
  35.  
  36. Tables:
  37.  
  38. x candidate1 candidate2 candidate3
  39. mean 5 1 3
  40. sd
Add Comment
Please, Sign In to add comment