Sigmoid Function Explorer¶
About This MicroSim¶
This interactive visualization demonstrates how the sigmoid function (also called logistic function) transforms a linear function z = mx + b into probabilities between 0 and 1. This transformation is the core of logistic regression for binary classification.
How to Use¶
- Adjust Slope (m): Move the slider to change the slope of the linear function
- Adjust Intercept (b): Move the slider to shift the linear function up or down
- Observe Transformation: Watch how the linear function (left, blue) transforms through sigmoid (right, orange)
- View Sample Points: See how individual points map from linear space to probability space
- Reset: Click "Reset Parameters" to return to default values (m=1, b=0)
Key Concepts¶
- Linear Function: z = mx + b produces values from -∞ to +∞
- Sigmoid Function: σ(z) = 1 / (1 + e⁻ᶻ) maps z to probabilities [0, 1]
- Decision Boundary: Points where σ(z) = 0.5 (shown as horizontal line)
- Slope Effect: Larger |m| creates steeper sigmoid → more confident predictions
- Intercept Effect: Changing b shifts the decision boundary left or right
Educational Value¶
This visualization helps students understand:
- How logistic regression transforms linear outputs into probabilities
- Why the sigmoid has an S-shaped curve
- How slope controls prediction confidence (steep = confident, flat = uncertain)
- How intercept shifts the decision threshold
- The relationship between linear decision boundaries and probabilistic predictions
Learning Objectives¶
Bloom's Taxonomy Level: Understand (L2)
After using this MicroSim, students should be able to:
- Explain how sigmoid function maps linear outputs to probabilities
- Describe the effect of slope on prediction confidence
- Understand how intercept affects the decision boundary
- Interpret sigmoid outputs as class probabilities
- Recognize the S-shape characteristic of the sigmoid curve
Technical Details¶
- Library: p5.js
- Responsive: Fixed canvas size (800x600)
- Interactivity: Slider controls for slope and intercept
- Features: Side-by-side comparison, sample points, real-time updates
Integration¶
To embed this MicroSim in your course materials: