Calculate and compare different loss functions
| Sample | Target (y) | Prediction (ŷ) | Individual Loss |
|---|---|---|---|
| #1 | 0.0100 | ||
| #2 | 0.0400 | ||
| #3 | 0.0400 |
Loss functions measure how far a model's predictions are from the true values, providing the signal that drives learning through gradient descent. Mean Squared Error (MSE) calculates the average of squared differences between predictions and targets, penalizing larger errors more heavily — it is the standard loss for regression tasks. Mean Absolute Error (MAE) uses absolute differences instead, making it more robust to outliers. Root Mean Squared Error (RMSE) is the square root of MSE, expressed in the same units as the target variable. Cross-entropy loss measures the difference between two probability distributions and is used for classification: binary cross-entropy for two-class problems (using sigmoid output) and categorical cross-entropy for multi-class problems (using softmax output). The choice of loss function directly affects what the model optimizes for and how it handles edge cases.
Built with care by Alpiaal