Topics

Logistic Regression

Source: Technology of Computing

Logistic regression is a machine learning algorithm used for classification problems. The term logistic is derived from the cost function (logistic function) which is a type of **sigmoid function** known for its characteristic S-shaped curve. A logistic regression model predicts probability values which are mapped to two (binary classification) or more (multiclass classification) classes.

Source: Analytics India Magazine

Formula of a sigmoid function

Where:

- 1 = the curve's maximum value
*S(z)*= output between 0 and 1 (probability estimate)*z*= the input*e*= base of natural log (also known as Euler's number)

In multiclass classification with logistic regression, a **softmax function** is used instead of the sigmoid function.

Like linear regression, gradient descent is typically used to optimize the values of the coefficients (each input value or column) by iteratively minimizing the loss of the model during training.

The **decision boundary** is the acceptable threshold at which a probability can be mapped to a discrete class e.g. pass/fail or vegan/vegetarian/omnivore.

The cost function in logistic regression is more complex than linear regression. For example, mean squared error would yield a non-convex function with many local minimums, making it difficult to optimize with gradient descent. **Cross entropy**, also called **log loss** is the cost function used with logistic regression.

â€‹Accuracy, a model evaluation metric, is used to measure how accurate a model's predictions are -- this is expressed as the number of true classifications divided by the total.

Linear vs Logistic Regression

â€‹

Last modified 2yr ago

Copy link

Contents

Linear vs Logistic Regression