Mathematics, Statistics & Geometry

Logistic Regression Calculator

Perform binary logistic regression using gradient descent optimization to model probability curves and find decision boundaries.

Weight (w)
0.722
Bias (b)-1.111
Sigmoid FunctionP(y=1) = 1 / (1 + e^(-0.7216x - -1.1109))
Calculation StepsInputs: N = 5 pairs Using Gradient Descent optimization: Learning Rate = 0.01, Epochs = 1000 Final Parameters: w = 0.721645 b = -1.110923 Decision Boundary (P=0.5): x = 1.5394

Calculated locally in your browser. Fast, secure, and private.

Predicting Binary Outcomes

The Logistic Regression Calculator is a foundational tool for machine learning. By utilizing iterative gradient descent, it finds the optimal weight and bias to fit an S-shaped sigmoid curve to your binary (0 or 1) classification data.

P(y=1)=11+e(wx+b)\begin{aligned} P(y=1) = \frac{1}{1 + e^{-(wx + b)}} \end{aligned}

Where:
P(y=1)=
The chance that the outcome belongs to class 1
w=
The calculated slope determining how X influences the probability
b=
The threshold shift of the sigmoid curve

Linear vs Logistic

If you try to use linear regression to predict a Yes/No outcome, the straight line will eventually shoot past 100% or drop below 0%, which makes no statistical sense. Logistic regression solves this by wrapping the linear equation (mx+b)(mx + b) inside a Sigmoid envelope, guaranteeing that the output is always a valid probability.

Real-World Applications

  • Medicine: Predicting the probability that a patient has a specific disease (1) or doesn't (0) based on their blood pressure levels.
  • Banking: Credit card fraud detection algorithms use logistic regression to evaluate if a transaction is legitimate (0) or fraudulent (1).
  • Marketing: Determining the likelihood that a customer will click on an email advertisement based on their past engagement metrics.

Frequently Asked Questions

Unlike linear regression which predicts continuous numbers (like price), logistic regression predicts categorical probabilities. It tells you the percentage chance that a data point belongs to a specific category.

A Sigmoid function creates an 'S-shaped' curve. No matter how large or small the input number is, the Sigmoid function will always squish the output into a probability between exactly 0 and 1.

Logistic regression cannot be solved with a simple closed-form algebraic equation like linear regression. It requires an algorithm (Gradient Descent) that takes 'steps' to gradually minimize the error.

It is the exact X-value where the probability crosses 50%. Anything below this boundary is predicted as '0', and anything above is predicted as '1'.

This calculator performs 'Binary' logistic regression, meaning it answers Yes/No questions. 1 represents 'Success/Yes' and 0 represents 'Failure/No'.