<jupyter_start><jupyter_text>Visualize<jupyter_code>### draw the decision boundary with the text points overlaid
prettyPicture(clf, features_test, labels_test)
# output_image("test.png", "png", open("test.png", "rb").read())

# from IPython.display import Image
# Image('test.png')<jupyter_output><empty_output><jupyter_text>Accuracy<jupyter_code># Predict
pred = clf.predict(features_test)

# Accuracy = number of points classified correctly / all points (in the test set)
from sklearn.metrics import accuracy_score
print "Accuracy of the Naive Bayes: ", accuracy_score(pred, labels_test)*100,"%"<jupyter_output>Accuracy of the Naive Bayes:  88.4 %
{'fraction_non_alphanumeric': 0.12018489984591679, 'fraction_numerical': 0.009244992295839754, 'mean_word_length': 7.666666666666667, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '194239', 'license': 'Unlicense', 'n_tokens_mistral': 228, 'n_tokens_neox': 215, 'n_words': 54, 'path': 'z_Miscellaneous/MachineLearning/NaiveBayes/jtest.ipynb', 'repo_name': 'dangkhoa1992/Advanced-Machine-Learning-Specialization', 'size': '649'}