Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 3. Naive Bayes
- # What it does: Uses probability based on Bayes' Theorem. Assumes all features are independent.
- # Use Case: Spam filters, sentiment analysis.
- from sklearn.naive_bayes import GaussianNB
-
- nb = GaussianNB()
- nb.fit(X_train_scaled, y_train)
- y_pred = nb.predict(X_test_scaled)
-
- print("Naive Bayes Confusion Matrix:\n", confusion_matrix(y_test, y_pred))
- print("\nNaive Bayes Classification Report:\n", classification_report(y_test, y_pred))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement