Guest User

Untitled

a guest
Feb 18th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import numpy as np
  2. from sklearn.naive_bayes import GaussianNB
  3. train_x=np.array(
  4. [[0.697, 0.460],
  5. [0.774, 0.376],
  6. [0.634, 0.264],
  7. [0.608, 0.318],
  8. [0.556, 0.215],
  9. [0.403, 0.237],
  10. [0.481, 0.149],
  11. [0.437, 0.211],
  12.  
  13. [0.666, 0.091],
  14. [0.243, 0.267],
  15. [0.245, 0.057],
  16. [0.343, 0.099],
  17. [0.639, 0.161],
  18. [0.657, 0.198],
  19. [0.360, 0.370],
  20. [0.593, 0.042],
  21. [0.719, 0.103]])
  22.  
  23. train_y=np.array([1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0])
  24.  
  25. gnb= GaussianNB()
  26. gnb.fit(train_x, train_y)
  27. print(gnb.predict([[0.697,0.460]]))
Add Comment
Please, Sign In to add comment