Logistic Regression
Logistic regression is a statistical method used to solve classification problems. Unlike linear regression, which predicts continuous outcomes, logistic regression predicts categorical outcomes.
In the simplest scenario, there are only two possible outcomes, which is referred to as a binomial distribution. For instance, predicting whether a romantic date is successful or not is an example of a binomial distribution. On the other hand, when there are more than two possible outcomes to classify, it is called a multinomial distribution. A common example of a multinomial logistic regression is predicting the class of an iris flower among three different species.
Here we will be using basic logistic regression to predict a binomial variable. This means it has only two possible outcomes.
X represents the time spent on a date in hours.
X = [[0.5] [1. ] [1.5] [2. ] [2.5] [3. ] [3.5] [4. ] [4.5] [5. ]]y represents whether or not the date is succesfull (0 for "No", 1 for "Yes").
y = [0 0 0 0 1 1 1 1 1 1]Disclaimer
The dataset used in this example is synthetic and was created for educational purposes to illustrate the application of logistic regression. It does not represent real observations.