Regularized Logistic Regression

We can regularize logistic regression in a similar way that we regularize linear regression. As a result, we can avoid overfitting.

The following image shows how the regularized function, displayed by the pink line, is less likely to overfit than the non-regularized function represented by the blue line:

Cost Function

Recall that our cost function for logistic regression was:

We can regularize this equation by adding a term to the end:

Gradient Descent

Disclaimer — This series is based on the notes that I created for myself based on various books and videos I’ve read or seen , so some of the text could be an exact quote from some book/videos out there.