From Prediction to Classification: Linear & Logistic Regression

1 Linear Regression 2 Conceptual Bridge 3 Logistic Regression

Linear Regression

Hover a data point: Move your cursor over any point on the graph to see its details here.
z = w · x + b
x is feature, w is weight, b is bias

Regression Controls

How to use: Adjust Weight & Bias sliders to move the line manually, or click Fit Optimal Line to auto-train. After training, the button greys out — click Reset Line to try again or pick a different feature.

Regression Metrics

MetricTrain
MSE-
RMSE-
R² Score-

Data Points

Conceptual Bridge

z = wx + b → σ(z) = 1 / (1 + e−z)

Bridge Animation

Linear output z = wx + b is transformed through the sigmoid to produce a probability.

The linear output is unbounded. The sigmoid squeezes it into [0, 1] to get a probability. Click Auto Animate to watch the transformation.

Linear vs Logistic Regression

FeatureLinear RegressionLogistic Regression
OutputContinuous value (unbounded)Probability between 0 and 1
Functionz = w·x + bσ(z) = 1 / (1 + e−z)
Use CasePredicting quantities (e.g. price)Classification (e.g. disease detection)
Decision BoundaryNot applicableThreshold at p = 0.5
Loss FunctionMean Squared Error (MSE)Log Loss (Cross-Entropy)
Curve ShapeStraight lineS-shaped sigmoid curve
Y-axis Range−∞ to +∞0 to 1

Logistic Regression

Hover a data point: Move your cursor over any point on the graph to see its details here.
z = w · x + b
p = 1 / (1 + e−z)
x is feature, w is weight, b is bias

Logistic Controls

How to use: Adjust Weight & Bias sliders to shape the sigmoid manually, or click Fit Optimal Curve to auto-train. After training, the button greys out — click Reset Curve to try again or pick a different feature.

Classification Metrics

MetricValue
Accuracy-
Decision Boundary-
Log Loss-

Data Points