-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Description
This is the code
import sys
from time import time
sys.path.append("C:/Users/ADWIN/Documents/GitHub/ud120-projects/tools")
from email_preprocess import preprocess
features_train, features_test, labels_train, labels_test = preprocess()
from sklearn.naive_bayes import GaussianNB
clf = GaussianNB()
t0 =time()
clf.fit(features_train, labels_train)
print ("Training time: ", round(time()-t0, 3), "s")
t1 =time()
predictions = clf.predict(features_test)
print ("Prediction time: ", round(time()-t1, 3), "s")
from sklearn.metrics import accuracy_score
accuracy = accuracy_score(labels_test, predictions)
print(accuracy)
And this, the error
c:/Users/ADWIN/Documents/GitHub/ud120-projects/naive_bayes/nb_author_id.py Traceback (most recent call last): File "c:\Users\ADWIN\Documents\GitHub\ud120-projects\naive_bayes\nb_author_id.py", line 22, in <module> features_train, features_test, labels_train, labels_test = preprocess() File "C:\Users/ADWIN/Documents/GitHub/ud120-projects/tools\email_preprocess.py", line 30, in preprocess authors_file_handler = open(authors_file, "rb") FileNotFoundError: [Errno 2] No such file or directory: '../tools/email_authors.pkl'
Anytime I try to run the code, this error pops up, I have tried moving the email_preprocess file into the naive_bayes directory but the issue persists.
Can any one help?
Metadata
Metadata
Assignees
Labels
No labels