#### World's Best AI Learning Platform **with profoundly Demanding** Certification Programs

Designed by IITians, only for AI Learners.

Internship Partner

In Association with

In collaboration with

Designed by IITians, only for AI Learners.

Internship Partner

In Association with

In collaboration with

New to InsideAIML? Create an account

Employer? Create an account

Designed by IITians, only for AI Learners.

Internship Partner

In Association with

In collaboration with

Enter your email below and we will send a message to reset your password

Designed by IITians, only for AI Learners.

Internship Partner

In Association with

In collaboration with

By providing your contact details, you agree to our Terms of Use & Privacy Policy.

Already have an account? Sign In

Designed by IITians, only for AI Learners.

Internship Partner

In Association with

In collaboration with

By providing your contact details, you agree to our Terms of Use & Privacy Policy.

Already have an account? Sign In

Download our e-book of Introduction To Python

Matplotlib - Object-oriented InterfaceMatplotlib - MultiplotsCNTK - Creating First Neural NetworkMatplotlib - Working with ImagesMicrosoft Cognitive Toolkit (CNTK) - CPU and GPUPython Forensics - Memory and ForensicsPython Blockchain - Scope and ConclusionDiscuss Microsoft Cognitive ToolkitMatplotlib - Twin AxesMatplotlib - Subplot2grid() Function View More

Exception Type: JSONDecodeError at /update/ Exception Value: Expecting value: line 1 column 1 (char 0) How can I write Python code to change a date string from "mm/dd/yy hh: mm" format to "YYYY-MM-DD HH: mm" format? How to choosing the right estimator for the machine learning problem? How to Write Python ZIP File? How to extracting text from PDF file using python How can a web interface execute a .py file from a PHP file? What methods can we use to differentiate between correlated and uncorrelated variables in a regression analysis? How to leave/exit/deactivate a Python virtualenvironment Join Discussion

4.5 (1,292 Ratings)

589 Learners

Sep 30th (7:00 PM) 1117 Registered

Ashish Katri

2 years ago

- How Logistic regression differ from the Linear regression

- What is The Sigmoid Function?

- What is The Activation Function and Why We Use It?

- What is The Significance Log of Odds Here?

- Learning the Logistic regression model:

Logistic regression is also a typical regression problem. It is used in Machine Learning. However, it is usually used for the purpose of classification with logistic function. It uses probabilities instead of the actual value.

Unlike Linear regression, the dependent variables can only
take a limited number of values i.e., the dependent variable is “categorical”
rather the continuous values.

When there are only two possible outcomes: spam or non-spam e-mail. Then it is known as “Binary Logistic Regression”.

A Binary logistic model has a dependent variable with two
possible value like **Pass/Fail, Yes/No, Male/Female, Healthy/Sick, Win/Lose
etc**. which are represented as** 0 **or** 1.**

There may be “**n**” number of independent variables,
each of type **Binary** or **Continuous**.

1)
Predicting the probability of failure of a
product.

2)
Employees Churn prediction.

3)
Cancer prediction.

4)
Likelihood of a customer purchasing particular
products based on his previous purchases.

5)
Predicting mortality of the injured patients.

In Linear regression, the output is the weighted sum of the
inputs.

Logistic Regression is a generalized Linear Regression in
the sense that we don’t output the weighted sum of the inputs directly, but we
pass it through a function that can map any value between 0 and 1.

As of now, you understood some basic idea behind Logistic
regression. But may you have a doubt that

Why can’t Linear regression can be used for classification
tasks?

Let me give a broad picture so that you get an idea behind
it.

Now let’s understand it with the help of a diagram

In the above figure, the left-hand side represents a neuron
representation of the Linear Regression model and right-hand side represent
Logistic regression model.

So, as you can see in the picture, that is the only difference between Linear Regression and Logistic Regression is that the results of these linear regression models are passed through the **“**activation function**”. i.e. Sigmoid** a function that maps any real value between 0 and 1.

The activation function that is used in logistic regression
is known as the “Sigmoid activation function”.

Often, sigmoid function refers to the special case of the **logistic function** is defined by the formula:

We see that the value of the sigmoid function is a number between 0 and 1.

This is exactly 0.5, x = 0.

We can use 0.5 as the probability threshold to determine the
classes.

If the probability is greater than 0.5, then it is class 1 else it is class 2.

The activation function mainly helps to decide whether a neuron should be activated or not by calculating the weighted sum and further adding bias with it. The goal of the activation of the function is to set the non-linearity of the output neuron.

Here I will not go into the details of activation functions.
Later I will try to write a separate article only on the topic of activation
functions.

I think you may be pretty clear about the main difference
between Linear Regression and Logistic Regression and where and where not both
can be used.

So as before only I already mentioned that logistic
regression uses the Sigmoid function to transform linear regression into the **logit
function**.

So, let’s understand first **what the log of Odds is?**

The odds ratio is calculated by dividing the probability of an event and the probability that it will happen. And then taking the log of Odds ratio will give the log of Odds.

The odds ratio can be also stated
that it’s the ratio of the probability of success to the probability of failure and
taking a log of this ratio gives us the log of odds.

Logistic function or sigmoid function can be converted into an Odds ratio:

The above equation is known as **“odds-ratio”. **

To obtain a logistic regression equation we taking a log of the linear regression equation.

The coefficients of the logistic algorithm must
be calculated from training data. This is done using **“maximum-
likelihood estimation”.**

Maximum Likelihood estimation is a method of **estimating** the parameters of a probability distribution by maximizing a **likelihood** function.

The best coefficients would result in a model that would that
would predict a value very close to 1 (e.g. male) for the default class and a
value very close to 0 (e.g. female).

For more such blogs/courses on data science, machine learning, artificial intelligence and emerging new technologies do visit us at InsideAIML.

Happy Learning…