| ID | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| -7.41 | -5.60 | -4.89 | -2.62 | -1.75 | -0.02 | 1.11 | 1.84 | 2.19 | 2.86 | 2.99 | 3.61 | 3.93 | 4.62 | 6.22 | |
| True | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 0 |
| Pred | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.11 | 0.18 | 0.22 | 0.29 | 0.30 | 0.36 | 0.39 | 0.46 | 0.62 |
| Correct | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ | ✓ | ✗ | ✓ | ✗ | ✗ | ✗ | ✗ |
| Confidence | 50.0% | 50.0% | 50.0% | 50.0% | 50.0% | 50.0% | 38.9% | 31.6% | 28.1% | 21.4% | 20.1% | 13.9% | 10.7% | 3.8% | 12.2% |
The Sigmoid (Logistic) Function maps any real value to a probability between 0 and 1:
The sigmoid has several crucial properties: its range is bounded to
Logistic Regression Model: The model computes a weighted combination of inputs and passes it through the sigmoid to obtain a probability:
To classify, we use a threshold (typically 0.5): predict class 1 if
Loss Functions: Unlike regression, we cannot use mean squared error (MSE) for classification because combining MSE with the sigmoid output creates a non-convex cost surface with multiple local minima. Instead, we use cross-entropy loss (also called log loss or negative log-likelihood), which is designed for probabilistic classification and remains convex:
Cross-entropy heavily penalizes confident wrong predictions: predicting probability 0.9 for class 1 when the true label is 0 incurs much larger loss than predicting 0.6. This encourages the model to be calibrated and honest about uncertainty.
Practical guidance: Use sigmoid activation for classification to obtain probabilistic outputs and smooth decision boundaries. The sigmoid ensures predictions stay in the valid probability range [0,1] and provides confidence estimates. Cross-entropy loss is the standard choice for training classification models because it properly handles probabilistic predictions and enables efficient gradient-based optimization.
Developed by Kevin Yu & Panagiotis Angeloudis