[PYTHON] Machine learning ② Naive Bayes Summary

Summary of Naive Bayes

What is Naive Bayes?

Naive Bayes is based on Bayes' theorem and is based on prior probabilities and their likelihoods (Explanation of Likelihoods). The posterior probability is calculated and classified into the category with the highest posterior probability. It is famous for being used to judge spam emails.

Screen Shot 2017-05-08 at 17.58.18.png Extracted from 'Introduction to Machine Learning', Udacity

The above is a naive Bayesian prediction of whether Sara or Chris sent it from the text of the'LIFE DEAL'email. The probability of sending each email of Chris and Sara is 50% (prior probability) Chris uses words at a rate of LOVE 10%, DEAL 80%, LIFE 10%, while Sara uses words at a rate of LOVE 30%, DEAL 20%, and LIFE 30%. (Likelihood)

So the posterior probability is Prior probability x Likelihood = Posterior probability Chris 10% × 80% × 50% = 0.04 Sara 30% × 20% × 50% = 0.03

If you fix this, 0.04 + 0.03 = 0.07 (this is 100%) Chris 0.04 / 0.07 = 0.57 → 57% Sara 0.03 / 0.07 = 0.43 → 43%

In other words, there is a 57% chance that it is Chris, so the result is that this email that says LIFE DEAL It is classified as Chris.

default code

python



from sklearn.naive_bayes import GaussianNB

GaussianNB(priors=None)

#That's the default code, it's simple.

The pros and cons of NaiveBayes.

Since each feature is considered independently and expressed on one dimension, the curse of dimentionality can be alleviated.

--Bad point

For example, as you can see from the first Chris and Sara email decisions, Naive Bayes only looks at the frequency of words, so it can't determine the order or combination of sentences. For example, in English, just adding not just before a verb can change the meaning by 180 degrees. That is, the features are regarded as one independent feature, and the correlation between the features is not considered.

Summary

The above is the outline of Naive Bayes as far as I can understand. We will update it daily, so if you have something to add or fix, we would appreciate it if you could comment.

Recommended Posts

Machine learning ② Naive Bayes Summary
Machine learning tutorial summary
Machine learning ⑤ AdaBoost Summary
Machine learning article summary (self-authored)
Machine learning ④ K-nearest neighbor Summary
Machine learning
Machine learning ① SVM (Support Vector Machine) Summary
Machine learning ③ Summary of decision tree
Machine learning beginners try to reach out to Naive Bayes (2) --Implementation
Machine learning beginners try to reach out to Naive Bayes (1) --Theory
scikit-learn How to use summary (machine learning)
"Python Machine Learning Programming" Summary Note (Jupyter)
Machine learning algorithm classification and implementation summary
[Memo] Machine learning
Machine learning classification
Machine learning algorithm (linear regression summary & regularization)
Machine Learning sample
Summary of evaluation functions used in machine learning
About machine learning overfitting
Machine Learning: Supervised --AdaBoost
Machine learning logistic regression
Machine learning support vector machine
Studying Machine Learning ~ matplotlib ~
Machine learning linear regression
Machine learning course memo
Naive Bayes (multiclass classification)
Machine learning library dlib
Machine learning (TensorFlow) + Lotto 6
Somehow learn machine learning
Summary for learning RAPIDS
Machine learning library Shogun
Machine learning rabbit challenge
Introduction to machine learning
Machine Learning: k-Nearest Neighbors
What is machine learning?
Machine Learning Professional Series Round Reading Session Slide Summary
Machine learning python code summary (updated from time to time)
Site summary to learn machine learning with English video
Summary of the basic flow of machine learning with Python
Machine learning model considering maintainability
Machine learning learned with Pokemon
Data set for machine learning
Japanese preprocessing for machine learning
Python Machine Learning Programming Chapter 2 Classification Problems-Machine Learning Algorithm Training Summary
Machine learning in Delemas (practice)
An introduction to machine learning
Machine Learning: Supervised --Linear Regression
Ensemble learning summary! !! (With implementation)
Basics of Machine Learning (Notes)
Machine learning beginners tried RBM
[Machine learning] Understanding random forest
Machine learning with Python! Preparation
Site summary where you can learn machine learning for free
Implement naive bayes in Python 3.3
Machine Learning Study Resource Notepad
Understand machine learning ~ ridge regression ~.
About machine learning mixed matrices
Machine Learning: Supervised --Random Forest
Practical machine learning system memo
Machine learning Minesweeper with PyTorch
Machine learning environment construction macbook 2021