0% found this document useful (0 votes)
26 views5 pages

EXP-2-To Implement Logistic Regression

Uploaded by

badgujarvarad800
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views5 pages

EXP-2-To Implement Logistic Regression

Uploaded by

badgujarvarad800
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Machine Learning Laboratory (PECO6051L)

Laboratory Report
Experiment No - 2
Batch -

Date of Experiment: __________ Date of Submission: __________

Title: To implement Logistic Regression


___________________________________________________________
Evaluation
1) Attendance [2] ----------------
2) Lab Performance [2] ----------------
3) Oral [1] ----------------

Overall Marks [5] ----------------

Subject Incharge

R. C. Patel Institute of Technology, Shirpur


Machine Learning Laboratory (PECO6051L)

Experiment No. 2
TITLE: To implement Logistic Regression

THEORY:
Logistic regression 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.
Logistic regression is a statistical algorithm which analyze the relationship between two data
factors.
Logistic regression is used for binary classification where we use sigmoid function that takes
input as independent variables and produces a probability value between 0 and 1. For example,
we have two classes Class 0 and Class 1 if the value of the logistic function for an input is
greater than 0.5 (threshold value) then it belongs to Class 1 it belongs to Class 0. It’s referred to
as regression because 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

R. C. Patel Institute of Technology, Shirpur


Machine Learning Laboratory (PECO6051L)

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.

The logistic regression model uses the logistic function (also called the sigmoid function) to
model the probability that a given input belongs to a specific class. The hypothesis function hθ
(x) for logistic regression is defined as:

Cost Function: To train the logistic regression model, a cost method is employed to calculate
the error between the predicted values and the actual class labels. The cost function is typically
the logistic loss (also called log loss or cross-entropy loss) for binary classification:

R. C. Patel Institute of Technology, Shirpur


Machine Learning Laboratory (PECO6051L)

Types of Logistic Regression

 Binomial: In binomial Logistic regression, there can be only two possible types of the
dependent variables, such as 0 or 1, Pass or Fail, etc.

 Multinomial: In multinomial Logistic regression, there can be 3 or more possible


unordered types of the dependent variable, such as “cat”, “dogs”, or “sheep”.

 Ordinal: In ordinal Logistic regression, there can be 3 or more possible ordered types of
dependent variables, such as “low”, “Medium”, or “High”.

R. C. Patel Institute of Technology, Shirpur


Machine Learning Laboratory (PECO6051L)

CONCLUSION / RESULT:

In this Experiment, we have performed logistic regression on given dataset.

R. C. Patel Institute of Technology, Shirpur

You might also like