Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. # Splitting the dataset into the Training set and Test set
  2. from sklearn.cross_validation import train_test_split
  3. X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.20, random_state = 0)
  4.  
  5. # Fitting Naive Bayes to the Training set
  6. from sklearn.naive_bayes import GaussianNB
  7. classifier = GaussianNB()
  8. classifier.fit(X_train, y_train)
  9.  
  10. # Predicting the Test set results
  11. y_pred = classifier.predict(X_test)
  12.  
  13. # Making the Confusion Matrix
  14. from sklearn.metrics import confusion_matrix
  15. cm = confusion_matrix(y_test, y_pred)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement