HomeToolsLoss Functions
All Tools

Loss Functions Calculator - MSE, MAE, Cross-Entropy

Loss Functions

Calculate and compare different loss functions

(1/n) Σ(y - ŷ)²

Data Samples

SampleTarget (y)Prediction (ŷ)Individual Loss
#10.0100
#20.0400
#30.0400

Total MSE Loss

0.030000

Loss per Sample

When to Use

  • MSE: Regression, penalizes large errors more
  • MAE: Regression, robust to outliers
  • BCE: Binary classification
  • Huber: Regression, best of MSE+MAE

Properties

  • MSE: Convex, differentiable, sensitive to outliers
  • MAE: Not differentiable at 0, robust
  • BCE: For probabilities, requires [0,1] range
  • Huber: Smooth, configurable δ threshold

What are loss functions in machine learning?

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