Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Splitting the dataset into the Training set and Test set
- from sklearn.cross_validation import train_test_split
- X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.20, random_state = 0)
- # Fitting Naive Bayes to the Training set
- from sklearn.naive_bayes import GaussianNB
- classifier = GaussianNB()
- classifier.fit(X_train, y_train)
- # Predicting the Test set results
- y_pred = classifier.predict(X_test)
- # Making the Confusion Matrix
- from sklearn.metrics import confusion_matrix
- cm = confusion_matrix(y_test, y_pred)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement