Understanding Logistic Regression
Logistic regression is one of the most widely used classification methods, and it works well when data is linearly separable. The objective of logistic regression is to squash the output of linear regression to classes 0 and 1. Let's first understand the "regression" part of the name and why, despite its name, logistic regression is a classification model.
Revisiting Linear Regression
In the case of linear regression, our mapping function would be as follows:
Figure 7.2: Equation of linear regression
Here, x refers to the input data and θ0 and θ1 are parameters that are learned from the training data.
Also, the cost function in the case of linear regression, which is to be minimized, is the root mean squared error (RMSE), which we discussed in the previous chapter.
This works well for continuous data, but the problem arises when we have a categorical target variable, such as 0 or 1. When we try to use linear regression...