0:00
Hey everyone, my name is Astha Chohan, welcome to the Tutorials Point
0:04
In the previous video, we have learnt all about the random forest. And in this video, we are going to learn about naive-based algorithm
0:11
So let's see what's in for you in this video. We are going to look at what is naive-based, introducing base theorem, base theorem example
0:20
knife-base working, what are the applications of knife-base, and what are the advantages of naive-base
0:26
So first, let's talk about what is knife-based. From definition, it is a classification technique based on base theorem with an independence
0:35
assumption among predictors. In simple terms, a knife-based class assumes that the presence of a particular feature in a class
0:43
is unrelated to the presence of any other feature. Basically, knife-based is based on base theorem and in this we assume that the presence of a particular
0:53
feature is unrelated to the another feature. Nile-based algorithm is based on base theorem
0:58
So it's important to understand the base theorem. So let's understand what is base theorem
1:03
Base theorem states that the conditional probability of an event based on the occurrence of another event is equals to the likelihood of the second event given in the first event multiplied by the probability of the first event
1:16
So this whole paragraph is basically defining this formula. So let's understand what are the terms in this formula
1:22
PAB is representing the probability of A when the B. is happening. Similarly, PBA is representing the probability of event B when the event A is happening
1:36
So the formula is PAB is equals to PBA multiplied by P.A upon PB, where PAB are the probability
1:45
of the event A and event B respectively Now let understand the base theorem with an example Let say we have to calculate the probability of king when it is given that the card is face card
1:57
So how we are going to calculate that? Let's see. So from base theorem, formula is probability of king when face is given
2:04
is equal to probability of face when king is given multiply by probability of king upon probability of face
2:13
So what will be the probability of king? it will be 4 upon 52 how there are 4 cards in a deck of 52 cards so it will be 4 upon 52 which will be equals to 1 upon 13
2:25
what is the probability of the face card when it is given that it is a king it will be 1 as all the king cards are face cards now what is the probability of the face card it is 12 upon 52 how there are 12 face cards in a deck of 52 cards so it will be equal to 3 upon 3
2:45
After putting all these values in the base theorem formula, we are getting 1 upon 3 as the probability of king when it is given that the card is face card
2:56
So that's how we use the base theorem. Now let's understand the working of the 9 base algorithm with an example
3:03
Let's say we have this dataset. In this we have features, outlook, humidity, wind, and we have dependent feature play, that means our outcome
3:13
In this we are predicting whether we are going to play outside or not on the basis of the given feature Outlook humidity and wind
3:21
So after we are having this data set, we are going to convert this into the frequency table on the basis of the features
3:28
So for the Outlook feature, our frequency table is like Sunny overcast and for Sunny we have 3 yes and 2 nose
3:35
And for overcast we have 4 yes and 0 nose Similarly we have frequency table for the feature humidity and and and for the feature wind So after having the frequency table we are going to make the likelihood table for each frequency table
3:50
Let's understand how we make the likelihood table for the first frequency table that is for the feature outlook
3:56
So here we have total 10 yes and 4 knows and if we talk about the total outcomes that are 14
4:04
So the probability of the sunny when it is given that we are going to play outside, that means yes, the probability will be 3 upon 10
4:13
And similarly for other categories like overcast and draining. Now what will be the probability of sunny
4:19
It will be 5 upon 14. 5 is total number of outcomes in this particular sunny category and 14 is our total number of outcomes
4:29
And now what will be the probability of yes? So the probability of yes will be 10
4:34
how we have total number of yes upon total number of outcomes that means 10 upon 14 so the likelihood of yes when the sunny is given it will be probability of sunny when yes is given multiply by probability of yes over probability of sunny
4:54
similarly likelihood of no when sunny is given will be probability of sunny when it is given no multiply by probability of no
5:03
upon probability of sin. Similarly, we will make the likelihood table for the feature humidity and likelihood table
5:12
for the feature wind. So after preparing the likelihood tables for each feature, let's say we have some new data
5:18
in which outlook is given rain, humidity is high, wind is weak, now we have to predict whether
5:24
we are going to play outside or no. What will be the answer? Yes or No
5:28
So how we are going to calculate this So the likelihood of yes on that day will be given as probability of rain outlook when yes is given probability of high humidity when yes is given probability of weak wind when yes is given and multiply by probability of yes
5:44
And similarly, likelihood of no on that day will be given as probability of rain outlook when no is given, probability of high humidity when no is given
5:54
probability of weak wind when no is given and multiply by probability of no so the likelihood of yes
6:00
is coming out 0.0199 and likelihood of no is coming out 0.0166 after that what will be the
6:08
probability of yes and no the probability of yes will be 0.0199 over total probability that is
6:15
0.019 plus 0.166 which is coming out 0.55 and similarly probability of no is coming
6:24
out 0.45. So here the probability of yes is greater than probability of no. So our outcome will
6:30
be yes we are going to play outside. Now here are some applications mentioned of naive base algorithm
6:37
First is news categorization, spam filtering, object and face recognition, medical diagnosis
6:44
and weather prediction. Now let's talk about the advantages of naive base algorithm. So first is it is
6:50
very simple and easy to implement highly scalable with number of predictors and data points
6:56
As it is fast, it can be used in real-time predictions and it is not sensitive to irrelevant features
7:02
So that was it for this video. We have already covered the supervised machine learning algorithm
7:07
K&N algorithm, the season 3, linear regression, support vector machine, random forest in the previous
7:12
videos and knife-based algorithm in this video. So in the next video we are going to talk about the logistic regression. So it's
7:20
stay tuned with tutorials point thanks for watching and have a nice day