Naive BayesIt is a classification algorithm based on probability theory. According to the Bayesian formula, it can predict and classify the probability of each category. Its solution is: according to the probability of each feature in the category, the item to be classified is classified into the category with the highest probability of all features.
Naive Bayesian properties
The prerequisite for using Naive Bayes is that the features to be classified are equally important and have no correlation with each other.
advantage:
- High learning and prediction efficiency, stable classification efficiency and easy to implement;
- It is still effective when there is less data and can handle multi-classification problems;
- As long as the condition of variable independence holds, the naive Bayes classifier performs best;
- It has the smallest error rate compared to other classification methods.
shortcoming:
- The classification effect is not particularly good;
- The feature independence assumption makes Naive Bayes simpler, but it will sacrifice a certain degree of classification accuracy;
- In practice, it is difficult to satisfy the assumption of independent conditions;
- If the categories of a categorical variable are not always observed in the training dataset, no prediction can be made.
Application scenarios and practices
There are usually two ways to implement Naive Bayes: based on the Bernoulli model and based on the polynomial model.
The main applications of Naive Bayes are:
- Real-time prediction
- Multi-class prediction
- Text classification / Spam filtering / Sentiment analysis
- Recommendation System
The idea of naive Bayes
What the Naive Bayes method does is to calculate which category y x belongs to. The process is as follows:
- Let
be an item to be classified, and each
is a characteristic attribute of
; - The categories to be classified are the set
; - Calculate the probability that
belongs to
: $latex {P{ \left( {y\mathop{{}}\nolimits_{{1}} \left| x\right. } \right) },\text{ }P{ \left( {y\mathop{{}}\nolimits_{{2}} \left| x\right. } \right) },\text{ }…,\text{ }P{ \left( {y\mathop{{}}\nolimits_{{n}} \left| - If
.
Related words: Naive Bayes classifier