Created
April 10, 2020 09:13
-
-
Save tarlanahad/928ab5c87a713d7ab83a8844e503ae51 to your computer and use it in GitHub Desktop.
This file contains 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
from sklearn.model_selection import train_test_split | |
from sklearn import datasets | |
data_x, data_y = datasets.make_classification(n_samples=10000, n_features=5, n_classes=2, random_state=123) | |
x_tr, x_ts, y_tr, y_ts = train_test_split(data_x, data_y, test_size=0.2, random_state=123) | |
nb = NaiveBayes(x_tr, y_tr) | |
nb.fit() | |
preds = nb.predict(x_ts) | |
print('Accuracy:', np.sum(y_ts == preds) / len(x_ts)) | |
# '> Accuracy: 0.9145 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment