Unit 2 Linear and Logistic Regression
Unit 2 Linear and Logistic Regression
(BCS-055)
Unit 2: Linear Regression
Where,
x and y are two variables on the regression line.
b = Slope of the line.
a = y-intercept of the line.
x = Values of the first data set.
y = Values of the second data set.
Question
Find linear regression equation for the following two sets of data:
• a=1.5, b=.95
• For x=12, Y=??
Logistic Regression
• It is a supervised machine learning algorithm used
for classification tasks where the goal is to predict the
probability that an instance belongs to a given class or not.
• It is a statistical algorithm which analyze the relationship
between two data factors.
• It uses sigmoid function, that takes input as independent
variables and produces a probability value between 0 and 1.
• It is the extension of linear regression but is mainly used for
classification problems
Key Points:
• Logistic regression predicts the output of a categorical
dependent variable. Therefore, the outcome must be a
categorical or discrete value.
• It can be either Yes or No, 0 or 1, true or False, etc. but instead
of giving the exact value as 0 and 1, it gives the probabilistic
values which lie between 0 and 1.
• In Logistic regression, instead of fitting a regression line, we fit
an “S” shaped logistic function, which predicts two maximum
values (0 or 1).
Logistic Function – Sigmoid Function
• The sigmoid function is a mathematical function used
to map the predicted values to probabilities.
• It maps any real value into another value within a
range of 0 and 1. The value of the logistic regression
must be between 0 and 1, 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 use the concept of the
threshold value, which defines the probability of either
0 or 1. Such as values above the threshold value tends
to 1, and a value below the threshold values tends to
0.