Regularized Logistic Regression

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

This Demonstration uses a logistic model to fit a selection of binary data. The degree of the underlying two-variable polynomial is 6. It is well known that high-degree models may lead to overfitting of the data. A common strategy to avoid overfitting is the use of regularization. This Demonstration investigates the impact of the regularization parameter on the final shape of the decision boundary.

Contributed by: Mikel Landajuela (November 2018)
Open content licensed under CC BY-NC-SA


The logistic model (or logit model) is a widely used statistical model that, in its basic form, uses a logistic function to model a binary dependent variable.

The model is represented as:


with , a sigmoid function.

The cost function takes the form:


where is the number of training examples and is the regularization parameter.

The data was obtained from [1].


[1] Coursera. "Machine Learning." (Nov 29, 2018)


Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.