Hello, so intersession, we are going to talk over what is logistic regression and we are going to
have in-depth induction of logistic regression.
Logistic regression is basically a classification algorithm.
So what exactly is this classification?
So you will see in project, our password feature has basically three categories and zero one two based
on some independent data or based on some features, had basically these three types of classes, or
I can see three types of categories.
That's why these type of problems comes under my classification problems.
Jamie, that's why for this type of problem statement, we have to use our classification algorithms
as HUMINT on this x axis.
I have it.
This weight and based on weight, I have to assign categories whether a person is obese or not, let's
say this is my zero, which will refer to the person is not obese.
And this exactly is one which refers to a particular person is obese.
Assuming this is a data set that I have supposed we have a task and we have a weight as 80 and we have
to predict whether this person is obese or not.
As you said, it is somewhere over here.
So let us think over here can be solved.
A similar problem statement using linear regression or not.
So what exactly was the regression?
It is nothing.
But just we draw a straight line such that distance between my actual point and my prediction point
will be my minimum.
That's what my linear regression will do.
And what exactly is notification?
Or I can see notations of linear regression.
That's nothing but Y equals to democracy.
Or you can see why to he tells you to do X or Y equals to B does zero plus beta one do X or Y equals
to W transpose into X plus B.
So if I have to draw my best foot line, which looks something like this here, if I have to predict
for this 80, so my 80 will be somewhere here.
So if you will notice, let's say this is my point, because this is exactly my middle value.
So using this linear regression, you will see it's probability is somewhere close to point four.
And it will if I'm going to round up this probability at this point for with somewhere across to zero,
that will come under this not obese category.
So if a person which has a weight of 80 cagy will definitely come under this not obese category.
That's what my linear regression will predict.
Similarly, let's say I have to predict for a person which had a weight off somewhere 100 Kaiji.
So somewhere here my one hundred will.
So if I'm going to map this hundred to my best foot line, it will give me probability somewhere close
to this point.
So I'm going to say it's probability if I win the round of this probability, it was somewhere.
Give me my one.
And according to this, I can see here that particular person, which has a weight of hundred Kaiji
will definitely be obese.
So it will give me a probability of pointed that I'm going to round off it and then once I get my probability,
either one or zero, then based on this I can see whether a person is obese or not.
So using this straight line, I am easily able to classify.
Yeah.
Whether a person is or with or not.
So what is the use of logistic regression if I am able to classify all my data points using this linear
regression?
So suppose I have somewhere here are outlier over here.
Somewhere here.
Suppose this is my new data point.
Then what will happen to this put line?
It will basically get tilted over there.
So this exactly will be my new best flat line.
But from ApoB data, we know bosun's that has weighed 80 AKG are of course not always, and the persons
that has a weight of hundred cagy are definitely obese, but is using this best foot line.
If you are trying to predict.
Yeah.
Whether that person is obese or not, then you will analyze if I'm going to map it.
Then you will analyze, yeah, this person is not obese because if the probability is somewhere close
to point four, so this fast food line will misclassify my data.
So this is exactly the drawback of linear regression and classification problem.
As once I have outlined in my data, my entire line gets deviated and it misclassify my data and it
will give high error rate.
So for this type of classification problem, we can't use this linear regression.
We can't use the concept of this best red line, because once I have outlined in my data, we have to
create best food line each and every time.
Similarly, for what if we have a product for the maximum good?
Let's say we have to predict four.
If I have to extend this line, let's say to a little bit, assuming I have to predict what a person
that has a weight of 220.
So using this best foot line, I can't predict very accurately that whether a person is under or with
categories or not or Biscardi, that exactly the drawback of doing a regression at the time of using
my classification problem statement.
So there are two major drawbacks of using linear regression.
So very first of all, it gets deviated by outliers.
You will see in this once I have this outlier in my statement, the whole best fit line gets treated
similarly.
Most of the time I am getting my probability value will greater than one and less than zero here.
Milena, regression care system you will see over here.
What if I have to predict for 220 k.g.
So it will exactly give me greater than one probability because if I have to map it to my best fit line,
it will give me probability for greater than one.
Similarly, let's say I have to predict for this negative side.
So in such case, if I have to map, in such case, if I have to map, it will give me a negative probability.
So what I can do in such cases.
So these are exactly two drawbacks of using linear regression.
So what is the solution of this like discussed over here?
So in order to solve this type of problem, we use this logistic regression with you, this concept
of sigmoid function internally and what exactly it will do, it will discuss this best fit line into
some zip code.
So we have to understand the maths behind this second diagram.
We have to understand the mathematics behind this logistic regression, how actually we operate this
type of goal.
So let's understand the logistic regression.
So it is always good to have both the geometric intuition as well as mathematical intuition.
So logistic regression is used to classify those data points where two classes are linearly separable.
So what is this linearly separate?
But what exactly is the meaning of this fancy term, this linearly separable, so linearly separable
is all about?
When we divided using our straight line, and this is exactly our straight line towards the of the straight
line, that is nothing but why calls to an extra seat and why calls to be zero plus veto next as well
as Y equals to W transpose X plus some constant B, and if I am assuming here that this is straight
line is passing from within.
So this B will be zero.
So my Y will be nothing but W transpose X.
So in this formula, what exactly is this w transpose.
Let me open a new page over here.
So suppose I have a straight line over here.
I can see this is my plain or a straight line and let's say here I have some data point.
Suppose this is my X data point.
And with respect to plan, suppose I have some coefficient value denoted as W so suppose this is my
coefficient value and if I have to compute distance between this data point and this plane, then according
to algebra that distance is nothing but W transpose X plus B up on this model S of W.
And if I will consider this as a unit vector, then it will become over and apart from days since this
line is passing from Orison, which I'm considering in my previous use case.
So this weekend do because intercept can be zero whenever my line is passing from Oddisee.
So what is this WPX or I can say W transpose X.
So this is nothing but a distance between this data point and this plane.
I assume you can plain name this plane as light.
So this is nothing but my distance between this X and Y, and this is exactly that distance.
Ceppos if you have multiple data points over here, a couple of extra extra X for X Y.
So in such case, what can be my total distance.
So that total distance is nothing, but it is just estimation of equals to one two n w I of transpose
of X.
So this can be my total distance by using this formula and this is nothing but a summation of all the
data point.
But I can see summation of all the distance with respect to each and every data point.
So I can call this W transpose X is nothing, just my distance between that point X and this plane Y.
And what our data point, which are AVAC, this is basically which Addabbo this is specifically if I'm
going to consult each and every data point which are above this specific plane.
And if I have to calculate distance between both the data point and this plane, it will always give
me this positive distance.
So you can come across a question why I am always have a positive distance, because you will notice
if I'm going to notice over here, this will give me my positive.
So this is my positive slope and this is exactly the positive moving slope.
And if I am going to calculate that every day over here, the slope of the derivative will always be
positive.
That's why it's always gave me positive distance whenever my data points are out of the plane and in
case if it is below the plane as my slope will get negative.
So in such case, I have this negative distance.
So these are the basics that you have to make sure for your logistic regression.
So that's all about recession hope.
So you will love it in the upcoming session.
I will do discuss the four major cases and the sigmoid function in that condition.
So thank you.
Have a nice day.
Keep learning.
Keep going.
Keep practicing.