From b6ad44a67a31eeab96e631efa2d0988ecb548c91 Mon Sep 17 00:00:00 2001 From: PraneethKumarT <67374533+PraneethKumarT@users.noreply.github.com> Date: Sat, 27 Jun 2020 22:55:12 -0700 Subject: [PATCH] Update nb_author_id.py --- naive_bayes/nb_author_id.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/naive_bayes/nb_author_id.py b/naive_bayes/nb_author_id.py index f69d57d8408..fd471fd519d 100644 --- a/naive_bayes/nb_author_id.py +++ b/naive_bayes/nb_author_id.py @@ -27,7 +27,17 @@ ######################################################### ### your code goes here ### - +from sklearn.naive_bayes import GaussianNB +clf = GaussianNB() +t0 = time() +clf.fit(features_train, labels_train) +print "training time:", round(time()-t0, 3), "s" +t0 = time() +pred = clf.predict(features_test) +print "training time:", round(time()-t0, 3), "s" + +from sklearn.metrics import accuracy_score +print accuracy_score(pred, labels_test) #########################################################