• Save
  • Run All Cells
  • Clear All Output
  • Runtime
  • Download
  • Difficulty Rating

Loading Runtime

Logistic regression is a statistical method used for binary classification, where the goal is to predict the probability of a binary outcome or event (such as Yes/No, True/False, 1/0). Despite its name, logistic regression is a classification algorithm rather than a regression algorithm, and it's used to model the relationship between the dependent variable and one or more independent variables.

The logistic regression model uses the logistic function (also known as the sigmoid function) to model the relationship between the independent variables and the probability of the binary outcome. The logistic function "squashes" the output to a value between 0 and 1, which represents the probability of the event occurring.

The model's output is a probability score, and to make binary predictions, a threshold (usually 0.5) is used. If the predicted probability is greater than the threshold, the observation is classified as belonging to the positive class; otherwise, it's classified as belonging to the negative class.

Logistic regression is widely used in various fields such as healthcare (predicting disease presence), marketing (customer churn prediction), finance (credit risk assessment), and more, where binary classification problems are encountered and the goal is to estimate probabilities associated with categorical outcomes.