Classification is a fundamental machine learning task where we predict discrete categories rather than continuous values. This demo explores binary classification in one dimension, comparing linear models with and without sigmoid activation.

In civil engineering, classification problems include failure prediction, quality assessment, safety categorization, and risk classification for structures and systems.

Threshold selection: While this demo uses the standard threshold of 0.5 (predict class 1 if P(y=1)0.5), in practice we often adjust this threshold based on application requirements. For safety-critical applications (e.g., structural failure detection), we might lower the threshold to t=0.3 to increase sensitivity—accepting more false alarms to avoid missing critical cases. The handout discusses this practical consideration in detail.
• Adjust α (slope) and β (position) sliders, and toggle sigmoid activation to compare linear vs sigmoid models
• Click above/below y=0.5 to add class 1/0 points, or use "Generate New Data" and "Clear All Data" buttons
• Observe how sigmoid activation changes predictions, loss functions, and decision boundaries

How does the sigmoid activation change the model behavior? Which loss function is more appropriate for classification?
Decision boundary: The point where the model switches between classes
Sigmoid benefits: Outputs probabilities (0-1 range) and smooth transitions
Linear vs sigmoid: Linear can predict outside [0,1], sigmoid cannot
Accuracy: Percentage of correctly classified points (same for both modes)
Cross-entropy loss: More appropriate for classification than MSE
Parameter interpretation: α controls steepness, β controls position

Classifier Type

Linear
Step
Sigmoid
0.1
0.0
f(x)=0.1x+0.0
Accuracy=60%
Loss=0.264

Predictions Table

ID01234567891011121314
x-6.61-4.30-2.56-1.93-1.450.910.991.362.062.442.893.883.896.777.61
True y000000111111011
Pred y0.000.000.000.000.000.090.100.140.210.240.290.390.390.680.76
Correct
Confidence50.0%50.0%50.0%50.0%50.0%40.9%40.1%36.4%29.4%25.6%21.1%11.2%11.1%17.7%26.1%

Developed by Kevin Yu & Panagiotis Angeloudis