Home▸Articles▸Machine Learning & Neural Networks

Logistic Regression: Sigmoid Decision Boundary (2D)

A fundamental technique in machine learning that models the probability of a binary outcome using a sigmoid function.

mysimulator teamUpdated June 2026≈ 3 min read▶ Open the simulation

What Logistic Regression Is

Logistic regression is a statistical method used in machine learning for predicting the probability of a binary outcome. It models the relationship between input features and an output variable that can take on only two possible values, such as yes/no or 0/1.

The model uses a sigmoid function to map any real-valued number into the range [0, 1], which can be interpreted as the probability of the positive class.

How Logistic Regression Works

Logistic regression models are trained using an optimization algorithm that minimizes the difference between predicted probabilities and actual outcomes. The sigmoid function is defined as S(x) = 1 / (1 + e^(-x)), where x is a linear combination of input features weighted by coefficients.

The goal is to find the optimal set of weights and bias such that the model's predictions closely match the training data.

live demo · related simulation● LIVE

Why It Matters

Logistic regression is widely used in various fields, including healthcare (for diagnosing diseases), finance (for credit scoring), and marketing (for customer segmentation).

Understanding logistic regression provides a foundation for more complex machine learning models and techniques.

Real-World Examples

In medical diagnosis, logistic regression can predict the likelihood of a patient having a specific disease based on symptoms and test results.

For e-commerce companies, it can help in predicting whether a customer will make a purchase given their browsing history and past behavior.

Frequently asked questions

What is the sigmoid function used for in logistic regression?

The sigmoid function maps the linear combination of input features into probabilities, which are then interpreted as the likelihood of belonging to a particular class.

How does gradient descent help in training logistic regression models?

Gradient descent is used to iteratively adjust the weights and bias to minimize the cost function, thereby improving the model's accuracy by reducing prediction errors.

Can logistic regression handle more than two classes?

Logistic regression can be extended to multi-class classification using techniques like one-vs-rest or softmax regression.

What are some limitations of logistic regression?

Logistic regression assumes a linear relationship between features and the log-odds, may not perform well with non-linear relationships, and can be sensitive to outliers in the data.

Try it live

Everything above runs in your browser — open Logistic Regression: Sigmoid Decision Boundary (2D) and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Logistic Regression: Sigmoid Decision Boundary (2D) simulation

What did you find?

Add reproduction steps (optional)