Created
July 21, 2017 13:10
-
-
Save FranciscusRenatus/c0f1c7c01b52136d51c49ce38795a338 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment