Skip to content

Instantly share code, notes, and snippets.

@yogeshnile
Created July 15, 2020 08:53
Show Gist options
  • Save yogeshnile/ad8eecfd4b647e277bd532abccee8e2d to your computer and use it in GitHub Desktop.
Save yogeshnile/ad8eecfd4b647e277bd532abccee8e2d to your computer and use it in GitHub Desktop.
#train_test_split
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, random_state=0)
#Fitting Naive Bayes to the Training set
classifier = MultinomialNB(alpha=0.1)
classifier.fit(X_train, y_train)
#Save Model
file_name = "Spam_sms_prediction.pkl"
pickle.dump(classifier, open(file_name, 'wb'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment