In this session, we will discuss about the based algorithm.
So first of all, before getting into my base, we need to understand a few concepts of probability.
So let us discuss about this particular data here, we have different fruits.
And out of these frauds, if we need to find out the probability of getting apples or oranges or bananas,
we will be having to find out the ratio of these.
So how would we do that?
To find out the probability of apples?
The probability of apples will be the number of apples divided by the total number of fruit.
Similarly, the probability of oranges would be.
The number of oranges divided by the total number of fruit and the probability of getting a banana would
be the number of banana divided by the total number of fruit.
Now, by this condition, if they want to find out the probability of getting E, then the probability
of getting it will be the number, the models of E divided by the models of the universe.
That is the number of a divided by the number of elements in the entire universe.
Now, if you want to find out the probability of getting the then the probability of getting the will
be the number of elements and in divide divided by the number of all the elements present in the universe.
So this is the statement for both of these.
Now, let us get further.
Now let us see that A and B actually intersect at a B, and we have some common elements named as Ebby.
Then what will be the probability of getting Aebi the probability of getting a will again be the problem,
the amount of the number of elements of a B divided by the number of elements in the universe.
Now, let us assume let us see that what is the probability of getting A, given that B is already two?
Now, if you want to find out the probability of a given vs already through, then the probability will
be the area which is both a B divided by the universe b, B, because these already through.
So we know that the universe for this is the.
So here, because the universe is V, so the probability of A given B is already through will be A B
divided by B.
Now, we can also write it up on the as a given universe and be given universe, so probability of A
given B will be equal to.
A B divided by universe, I'm B divided by Univers now this storm can also be written as.
Probability of a.
And similarly be given, Univers can also be written as probability of being.
From this, we can derive that probability of A given B is equal to probability of any given problem
divided by the probability of B.
Now, can we derive the probability of being given a using this?
So the probability of A, given B is probability of Ebbie divided by probability of me.
So just swapping all the envy's.
So what do we get?
We get probability of be given e- equal to probability of A B divided by the probability of A.
Now, let us try to replace the probability of EBE here with the probability of evacuation, which we
get from this one.
So what do we get?
We will get a probability of Ebbe and probability of V is equal to probability of being in probability
of.
A not as probability of a given be in the probability of B, equal to probability of being given, E
in the probability of A.
Hence, we can see the probability of A given B is equal to probability of be given E in the probability
of E divided by probability of B.
So we are treating probability of a given me is equal to probability of be given a Endou probability
of E that is.
What we are trying to find out, divided by the probability of V, which is given here.
So how do we do that?
Now.
What are the values here, probability of a human being is equal to probability of a intersection B
A born probability of B.
That is equal to probability of the probability of being given a divided by probability of the.
Here, the probability of a probability of a probability of these probability of the probability of
a human being is.
Probability of a given.
This means that probability of being given A and B of A intersection B, this is the probability of
both A and B occurring.
Now, let us try to relate this to the problem which we have.
Now, the statement which we have just created, this is called the Nijhuis Equation.
Now, let us have a look at this and try to relate it to the type of problem that we have now, usually
let us take the loan data example.
Now we want to find out the probability of a person defaulting on a loan given certain conditions.
What are those conditions?
Those conditions are different values of those features.
That is different attributes.
So we have to find out if someone will default on the loan or not based on what is the salary of the
person, how many children he has.
What are the number of dependents?
What is the FICO range?
So based on all of these criteria?
We want to find out the probability of it, so now you can relate to this, right?
This is actually the value by which we want to predict and B, are the X values, that is the input
values that are features or attributes or the independent variables.
Now thinking about independent variables, so the property of independent variables is that we are trying
to find the intersection of all these, when all of these things are true, then all of these intersection
is true that this we want to find out the probability of E for different combinations of these one be
to be three before.
Now, what are these be1 B to be three, four?
So these will be if the someone has the number of children as one, if someone has a number of dependents
do and then what is the salary of the person?
So these good ideas together will become a condition.
And that condition has been depicted by this intersection.
Now we will have the same thing and all the places that is probability of a given BE1 be to be investigated.
Is equal to probability of an intersection between the Section B, the intersection before given E and
the probability of A divided by probability of one intersection, probability of BIDU intersection,
probability of B three and so on.
Now, can we record this?
Can we re establish this particular thing to reestablish this week and also write this as probability
of BE1 given E in into probability, agree to give an E in to probability of victory given and so on?
And why is that?
So if they are to find out the probability of multiple endives, given one condition, then if the.
Different conditions are independent of each other, then they could be said to be multiplied.
So when we are finding out probability and different conditions are occurring together, then we can
find out the probability of one thing and multiplied with the probability of the other one.
That is how we calculate probabilities so we can subdivide this and find out probability of given the
probability of being given a probability of ubani and hence find out the probability of a given we when
be do be three.
So to saw this kind of problem, we can use this.
Particular formula, which we have from the ninth base equation and VI is the base equation.
Why is this particular algorithm called Knife?
The equation is based Hürrem, but this algorithm is called Navys because it assumes that all these
BE1 V to be three are independent.
That is the reason why the first thing which we do while creating the data for this particular algorithm
is we remove all the correlations.
Which we have already learned during our data preparation, that is we will remove all the related variables
and we will remove all the variables will have to be present so that all of these attributes be one
be to be three are independent of each other.
So what is Meyvis?
The night vision classifier is based on the beast Hürrem, with the independence assumption between
the predictors, so between the predictors, these are the predictors X one extra extra X for values.
It is assuming that all of these predictors are independent from each other.
A NIMBY's model is easy to break with, the more complicated.
If I drew the barometer estimation, which makes it particularly useful for a large dataset now for
knives, we don't have to.
I daily find out values for different Fatah leaders.
We just need to find out probabilities.
So that is easily done for a very large dataset.
Now, although it is simple knives in classified, it often does surprisingly well and is widely used
because it often outperforms the more sophisticated classification methods, so it might outperform
random forest or extra boost.
So that is why Nijhuis is one of the favorite algorithms.
So what about the Elgort and what do we have in the algorithm?
So for this algorithm, the base theorem provides a way of calculating the posterior probability that
this probability of C given X or probability of Vivan human X from the prior prior is what data we already
have.
That is probability of C operating independently, probability of X acting independently, and probability
of X given C..
So we already have this data and using all this data, we just want to find out the probability of C
given X or probability of Y given X.
The prior probability is the probability of an event before new data is collected and posterior probability
is the revised probability of an event occurring after taking into consideration new information.
OK, now posterior probability is the probability of event e occurring given that event, event B has
already occurred.
So what are these event B, these events?
These are nothing but the predictors, the probabilities of the features and the attribute having those
values which they already have.
Now the Navy's classifier assumes that the effect of the value of a predictor on a given Class C is
independent of the values of other predictors.
So for one column, that is let's say we have three features age, gender and salary, then the impact
of age is independent of the impact of salary or the impact of gender.
So that is the main assumption, and that is why it is called knife tuto.
Now, this assumption is called conditional independence, and it is called because of the glass conditional
independence only.
So that is why the Navy's got the name in.
OK, so the main task here is to find out the probability of E!
That is why Vidi got a good value.
The probability of a class having occurred with respect to the different feature and attribute values
already have been occurring.
So how do we do that?
So let us solve this problem first.
So we have this data.
This is the data that you would have already seen during the decision tree creation.
So we looked at the data where we had our rainy, overcast and sunny and the first split which we had
made was using rainy, overcast and sunny.
And then we have temperature, different temperature values, different humidity values and different
Vendy values.
And based on this, we actually decided if the Chinese should play or not.
So how do we do this, so we have this data, so from this particular data, we will create a frequency
table that is the number of occurrences of these values.
So we will check the frequencies.
So the frequency table for our different outlook values will be for Sunee play.
Golf has three yeses and doulos for overcast play.
Golf has for yes and zero news for me.
Play Golf has two yes and three no's.
Now, from this, we will create the likelihood.
How do we create that so we have three values here.
And the total number of values I.
Nine.
Three plus four plus two.
That is nine, so we see three by nine, four by nine, two by nine.
So Sonny has three by nine of yesses, overcast has four by nine of us, and really has to by nine orfeus.
So we get nine by 14, so nine items out of 14 have yes, in our.
Similarly, we find out the similar table for no, we calculate the same thing for No.
And we have to find out the probability of X given or probability of it being Sunee given, it is yes.
So probability of having Sunee given it is yesses three by nine.
Right.
Dorville, yes, nine.
And there are three entities with Sunny, so the probability of getting sunny as a result, given it
is yes, is three by nine.
Similarly, we can find out the ratios for overcast, rainy and.
From this, we can calculate the probability of yes and the probability of sunny, so the probability
of yes is nine by 14, that is nine times.
It is, yes, and hopefully 14 data points out there.
Then the probability of it being sunny is five by 40.
Similarly, we can find out the probability of it being overcast, probability of it being rainy.
That is four by 14, five by 14.
Now, what is the probability, the probability is probability of yes, given it is sunny, so what
how will we find this out?
We will find this out by multiplying the values.
So it comes out to be zero point three three in zero point six four in zero point, divided by zero
point three six.
That is probability of yes, given it is sunny is equal to probability of sunny, given it is, yes.
And the probability of it being.
Yes, divided by the probability of.
Sunny, this is just the simplest implementation of the nine best.
Formula, the simplest implementation of this formula.
You can pause the slide and have a look at this, how this is performing, because it is very important
to understand so you can pause any time and have a look at this table and understand how this has been
constructed.
Next, we will find out the probability of no, given it is sunny, so the probability of no, given
it is sunny, will be the probability of sunny, given it is no end to the probability of no divided
by probability of it being sunny.
Similarly, we will create different likely would be moods and frequency tables for humidity, temperature
and windy.
So for all all four of the features, we will create the stable.
Now, when we want to find out if someone has to play, then how would we do that?
We will do that using we will be finding all probability of yes, given different X values.
So what are the X values?
Let's see.
We want to find out for the rainy outlook.
Temperature, cool, humidity, high and windy.
So how will we find this out?
So probability of yes, given X will be probability of.
So probability of a given certain conditions is equal to probability of condition, one, given a probability
of condition to give given be given a probability of condition to be given in to probability of a..
So let us get to that.
So probability of condition given, yes, probability of another condition given in the probability
of another condition given.
Yes, in all probability of next condition, that is probability of rule given.
Yes, indeed.
Probability of yes.
So what do we get from this weekend, probability of yes, given X as zero point zero zero five two
nine.
Now, we will divide this value by.
The probability of.
Intersection of all of these.
So the probability of intersection of all of these will be.
This some value, so this is what the result will be.
Similarly, we can calculate the probability of no given XL's.
And you can see it is.
Contrasting to this one, so the probability of us given X is zero point two and the probability of
no given exists zero point eight.
So this is the end of my base, I will be providing another example question to you so that you can
practice that and find out the values of probabilities using the base formula.
And I visited him.
And in the next session, we will be implementing my base algorithm using Escalon.