You are reading the article **Naive Bayes In Machine Learning** updated in September 2023 on the website Dacvumuahe.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. *Suggested October 2023 Naive Bayes In Machine Learning*

Naive bayes in machine learning is defined as probabilistic model in machine learning technique in the genre of supervised learning that is used in varied use cases of mostly classification, but applicable to regression (by force fit of-course!) as well. The reason of putting a naïve in front of the algorithm name is because it assumes that the features that goes into the model are independent of each other or in other words, changes done to one variable doesn’t affect any others. Though this assumption is a strong one and happens to be a basic one and, the effect of the variable is present. Due to this algorithm, Naïve Bayes happens to be a simple, yet very powerful algorithm. Due to its lesser complexity this is the go-to choice for any of the algorithms where in one either has to respond to a request quickly or one needs to perform some calculation in order to provide some basic yet powerful insights from the data!

Start Your Free Data Science Course

How Naive Bayes works in machine learning?In the introduction we have understood that Naïve Bayes is a simple algorithm that assumes the factors that are a part of the analysis are independent to each other and that the answer to Naïve in its name. but what about the other word Bayes. In order to have a deeper understanding of Naïve Bayes algorithm, we would first understand the Bayes theorem in conditional probability.

Let us understand the Naïve Bayes with an example. Let us take the very generic example, rolling a dice. What is the probability that we would get a number 2? Since there is one “2” in the dice, and total 6 possibilities, the probability is 1/6. Now, let us enhance the example a bit more. We are at a guessing game, where one has to ask some questions and on the basis of that, we have to guess the number and pattern on the card. At first, we would have 4 possibilities and only one is true, and hence the probability is ¼. Let say we have guessed the color of the pattern, now to guess the pattern there are only 2 possibilities present and one of them has to be true and hence the probability of us being correct is ½ which is obviously more than ¼. Did you notice the difference in the statements? In the case of dice, there is no condition, whereas in case of cards the condition is that the color is already known. Thus, probability of an event to occur when a condition is given is known and conditional probability and the theorem that dictates this is known as Bayes theorem. The mathematical equation of the same is given as:

Now keeping the above theorem in mind, let us see the working of Naïve Bayes. In real-world examples, we might have multiple X variables in the data and with the statement that multiple X variables are independent we can substantiate that the probability will follow a multiplicative relation to finding the probability. The equation will look something like:

With setting of this context, now let us take an example to fully understand the working of Naïve Bayes through an example in classification. The working takes place in 3 steps. Let us look at the steps first and then take one example and get a hands-on understanding of the working.

Finally, the above calculation using the formula of Bayes’ theorem is used to calculate the posterior probability when any new dataset is sent for prediction.

Original Data:

Income Status Gadget Bought?

Low Yes

Mid Yes

High Yes

High Yes

Mid No

Low No

Mid Yes

High Yes

Low No

Mid No

Mid Yes

Low No

High Yes

High Yes

Step 1: Frequency table creation

Income Group Yes No

High 5 0

Mid 3 2

Low 1 3

Total 9 5

Step 2: Probability calculation of the likelihood income groups

Income Group Yes No

High 5 0 5/14 = 0.35

Mid 3 2 5/14 = 0.35

Low 1 3 4/14 = 0.3

Total 9/14 = 0.64 5/14 = 0.36

Step 3: Now whenever a new dataset comes, we can tell the corresponding probability that whether the person will buy the gadget or not by using the posterior probability formulae. Let us say that the new data is with income group as Mid. We would need to find out if the person will buy a gadget or not.

P(Mid) = 5/14

So, we can conclude that if the person is of Income Category Mid, he has a higher propensity to buy the gadget.

ConclusionIn this article though Naïve Bayes with an example to understand the core learning of algorithms. This simple yet powerful method gives us propensity score of a class happening or not and the concept can be extended to multinomial classification easily although using it in regression might be a force fit!

Recommended ArticlesThis is a guide to Naive Bayes in Machine Learning. Here we discuss Definition, How Naive bayes works in machine learning? with methods respectively. You may also have a look at the following articles to learn more –

You're reading __Naive Bayes In Machine Learning__

Update the detailed information about **Naive Bayes In Machine Learning** on the Dacvumuahe.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!