From Prediction to Classification: Linear & Logistic Regression
Linear Regression
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
| Metric | Train |
|---|---|
| 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
| Feature | Linear Regression | Logistic Regression |
|---|---|---|
| Output | Continuous value (unbounded) | Probability between 0 and 1 |
| Function | z = w·x + b | σ(z) = 1 / (1 + e−z) |
| Use Case | Predicting quantities (e.g. price) | Classification (e.g. disease detection) |
| Decision Boundary | Not applicable | Threshold at p = 0.5 |
| Loss Function | Mean Squared Error (MSE) | Log Loss (Cross-Entropy) |
| Curve Shape | Straight line | S-shaped sigmoid curve |
| Y-axis Range | −∞ to +∞ | 0 to 1 |
Logistic Regression
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
| Metric | Value |
|---|---|
| Accuracy | - |
| Decision Boundary | - |
| Log Loss | - |