Logistic Regression


Hello friends, today i am gonna discuss about one of the key concept in supervised learning. Supervised learning is the training a model on defined datasets. In the section of supervised learning, there are some type of regression for e.g, Linear and non-linear regression models.

Logistic regression is a type of regression which allows us to do classification by separating the two types of labels with the help of line (if 2-D, that is if we have only two features) or with the help of plane (if 3-D, having three features) or most often hyperplane which will be simply used in multidimensional datasets that is more than two features in training data.

Logistic regression can be simply explained by concepts of linear geometry that we have learnt earlier. suppose we have data points like this shown in figure

data points

Now here we can see that there are two classes of data points that needs to be classified and this model is based on two features so for classification we can use logistic regression. logistic regression will have equation for straight line like this y=mx+b that is equation of simple line.

Now we will convert this equation to sigmoid function which will help to keep our values between 0 and 1. So what does it mean that in logistic regression model we work with only two values 0 or 1 for classifying two types of labels. Hence, sigmoid function will look like this and distinguish between two in the following manner.

logistic regression

Here, in this plot we can see the sigmoid function of our given equation separating two types of label. So, we can conclude that high value (1) indicates that it belongs to some class (say class 1) and low value (0) belongs to class (say class 2). So, in this way we have used logistic regression using sigmoid function and can classify labels.

Similarly, we can implement for 3-D or multidimensional datasets and features for more accurate results. Only thing, will change that is from line to plane or hyperplane like shown below