Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions naive_bayes/nb_author_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

import sys
from time import time
from time import ti
sys.path.append("../tools/")
from email_preprocess import preprocess

Expand All @@ -24,8 +24,17 @@



#########################################################
### your code goes here ###
from sklearn.naive_bayes import GaussianNB
clf=GaussianNB()
t0=time()
clf.fit(features_train[0:1400],labels_train[0:1400])
print("training time",round(time()-t0,3),"s")
t0=time()
pred_label= clf.predict(features_test)
print("testing time:",round(time()-t0,3),"s")
from sklearn.metrics import accuracy_score
acc=accuracy_score(labels_test,pred_label)


#########################################################
Expand Down