**What is Logistic Regression?**

Logistic Regression is a machine learning model.

Why machine learning model? We need a machine learning model, in the sense that: that model will be used by the machine to learn something. The machine will learn something out of data. The model will help the machine to make some sense out of data. And the best part is, when it makes sense out of data, it can do some useful tasks, like: predicting, classifying, on its own.

**Can you give examples of problems where Logistic Regression can be put to use?**

For example, we want to know if a person will likely have diabetes. We need some parameters to judge whether this person will get diabetes. To simplify things, let us consider some features/parameters like: person’s height, person’s weight, person’s blood pressure.

So, as software engineers, we have a method which takes some input and it will generate some output. Something like follows:

public boolean doesPersonHaveDiabetes ( Height p_height, Weight p_weight, BloodPressure p_bloodPressure) {}**What is the difference between Linear Regression and Logistic Regression?**

**What is the difference between Logistic Regression and Linear Regression?**

Linear Regression is great for predicting **continuous values** (what will be the stock price after 5 mins given some basic set of conditions ) .

Logistic Regression is great for predicting **discrete outcome** ( does person have diabetes or not ).

So, we are going to use a Logistic Regression model to predict an outcome ( yes or no).

Why “Logistic” ? ( Enter Mathematics … )

The core part of Logistic Regression is the ‘Logistic function’ or ‘Sigmoid function’, which looks like:

From above function, we see that the numerator is 1 and denominator is restricted to take values ( 1+ e^-x ). As you can see, the function takes values from 0 to 1. For the range of values of x, we see that max is 1 and min is 0. This fits into our scenario, where we want to know diabetes or not, we can say: more than 70% probability, then yes. Otherwise no.

**Can we use logistic regression model for all kinds of input data ?**

No, we can use it only when input space is linearly separable.

### Like this:

Like Loading...