Logistic regression is a supervised learning algorithm used for classification tasks, predicting the probability of an instance belonging to a class using a sigmoid function. It differs from linear regression by outputting probabilities for categorical dependent variables rather than continuous values. There are three types of logistic regression: binomial, multinomial, and ordinal, each catering to different types of dependent variables.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0 ratings0% found this document useful (0 votes)
15 views5 pages
ML (08-08-2024)
Logistic regression is a supervised learning algorithm used for classification tasks, predicting the probability of an instance belonging to a class using a sigmoid function. It differs from linear regression by outputting probabilities for categorical dependent variables rather than continuous values. There are three types of logistic regression: binomial, multinomial, and ordinal, each catering to different types of dependent variables.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
Logistic Regression:
Logistic regression is a supervis i ing i
for classification tasks where Teco ee eamiog algorithm, vie
instance of belonging to a given class. It is used for Wasclicaties pe with i
name is logistic regression. it's referred to as regression beceiise W take ta es
output of the linear regression function as input and uses a sigmoid fi ca a
estimate the probability for the given class. The difference between inset '
regression and logistic regression is that linear tegression output is the
continuous value that can be anything while logistic regression predicts the
probability that an instance belongs to a given class or not.
It is used for predicting the categorical dependent variable using a given set of
independent variables.
+ Logistic regression predicts the output of a categorical dependent variable.
Therefore the outcome must be a categorical or discrete value.
\gcan be either Yes or No, 0 or 1, true or False, etc. but instead of giving the
at ‘value-as 0 and 1, it gives the probabilistic values which lie between 0
ogistiéRegression is much similar to the Linear Regression except that
sShow.they are used. Linear Regression is used for solving Regression
“problems, whereas Logistic regression is used for solving the classification
problerns
~'s In Logistic regression, instead of fitting a regression line, we fit an “S”
shaped logistic function, which predicts two maximum values (0 or 1).
+ The curve from the logistic function indicates the likelihood of something
such as whether the cells are cancerous or not, a mouse is obese or not
based on its weight, etc. $ . 7 ‘
+ _ Logistic Regression is a significant machine learning algorithm because it
has the ability'to provide probabilities and classify new data using
continuous and discrete datasets. 7 he
« Logistic Regression can be used to classify the observations using different
types of data and can easily determine the most effective variables used for
the classification.
Logistic Function (Sigmoid Function): : .
«The sigmoid function is a mathematical function used to map the predicted
values to probabilities. :
+ Itmaps a real value into another value within a range of 0 and 4.0 The
value of the logistic regression must be between 0 and 4, which cannot go
beyond this limit, so it forms a curve like the “S' form. :
«The S-form curve is called the Sigmoid function or the logistic function.+ In logistic regression, we us,
value tends to 1, and a value bel
Type of Logistic Regression:
On the basis of the categories, Logistic Regression Can be cl.
types:
1. Binomial: In’ binomial Logistic re,
'@ the concept of the threshol ic
defines the probability of either 0 or 1. Such as values shoyu: Which
lUes above the threshold
low the threshold values tends to 0.
lassified into three
gression, there can be only two possible
types of the dependent variables, such as 0 or 1, Pass or Fail, etc,
2. Multinomial: In multinomial Logistic regression, there
can be 3 or more
possible unordered types of the dependent variable, such as “cat”, “dogs”, or
“sheep”
3. Ordinal: In ordinal Logistic regression, there can be 3 or more possible
ordered types of dependent variables, such as “low”, “Medium”, or “High”.
Sr.No
Linear Regression
the continuous dependent varia
variables.
2 Regression problem.
In this we predict the value of
3 continuous variables
4 Inthis we find best fit line,
Th. whoa at SSI
Least square estimation method is
5 Used for estimation of accuracy.
The output must be continuous.
6 value, such as price,age,etc,
It required linear relationshi
between dependent and
7 independent variables.
using a given set of independent
Linear regression is used for solvin
solving,
Logistic Regression
Linear regression is used to predict Logistic regression is used to
predict the categorical dependent
variable using a given set of
independent variables.
It is used for solving classification
problems. ~ SOS
In this we predict values of
categorical variables
In this we find S-Curve .
Maximum likelihood estimation
method is used for Estimation of
accuracy.
Output is must be categorical value
such as 0 or 1, Yes or no, etc.
It not required linear relationship.Sr.No Linear Regression Logistic Regression
There may be collinearity between — There should not be collineari
8 the independent variables. between independent abies
How does Logistic Regression work?
The logistic regression model transforms the linear regression function
continuous value output into categorical value output using a sigmoid function,
which maps any real-valued set of independent variables input into a value
between 0 and 1. This function is known as the logistic function.
Let the independent input features be
and the dependent variable is Y having only binary value i.e. 0 or 1.
0 if Class 1
Ys { if Class2
then apply the multi-tinear function to the input variables X
2=(Diiwin) +b
Here zis the ith observation of X, t= ft, w2 tan + tm) is the weights or Coefficient,
and bis the bias term also known as intercept. simply this can be represented as the
dot product of weight and bias.
g=weX+b
whatever we discussed above is the linear regression.Sigmoid Function
Now we use the sigmoid function where the input will be z and we find the
probability between 0 and 1. i.e predicted y.
‘Sigmoid function
As shown above, the figure sigmoid function converts the continuous variable data
into the probability ie. between O andi.» ‘
« O(2) tends towards Las 2 —+ 00
+ 7(2) tends towards 0as Z —> —00
« 7(Z) jg atways bounded between O and 1Logistic Regression
Given dataset containing N training example x; each with associated class Yi
learning rate (a ) = 0.01, y,=0 (Non-thunderstorm), y, = 1 (thunderstorm), n=
total number of features. Each sample X= (Xo, Xp Xo. Xp)
‘Step 1: Compute the value of Hypothesis
Hypothesis = he(z) = ry
80" Xo
Where parameter @=] | and x =| ?
2, Xn
The value @ is computed using Gradient descent where the value of al
updated simultaneously
Repeat t rn x
¥
aS (to (2) = yO) x
Step 2: To make prediction of new X’, put the value of X’ in X in the eq
te) = Taare
If h(x) = 0.5 Ci is equal to. Thunderstorm
If h(x) < 0.5 Ciis equal to: Non- thunderstorm