Naive Bayes Algorithm for Binary Classification with Laplace Smoothing.
Data is taken from kaggle competition Real or Not? NLP with Disaster Tweets
Data Sample:
print(f"Two tweets == {x_train[:2]}")
print(f"Tweet Label == {y_train[:2]}")
from scratch.models.naive_bayes import NaiveBayes
nb = NaiveBayes()
nb.fit(x_train, y_train)
nb.classes
nb.vocab_length
predictions = nb.predict(x_test)
accuracy(y_test, predictions)