Example #1
0
    Chris has label 1
"""

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

### features_train and features_test are the features for the training
### and testing datasets, respectively
### labels_train and labels_test are the corresponding item labels
features_train, features_test, labels_train, labels_test = preprocess()

#########################################################
### your code goes here ###

from sklearn.naive_bayes import GaussianNB
gnb = GaussianNB()

t0 = time()
gnb.fit(features_train, labels_train)
print "training time:", round(time() - t0, 3), "s"

t1 = time()
gnb.prefict(features_test)
print "predict time:", round(time() - t1, 3), "s"

print gnb.score(features_test, labels_test)

#########################################################