Mean Squared Logarithmic Error (MSLE) is a loss function commonly used in regression tasks, particularly when the target variable can vary across several orders of magnitude. MSLE is defined as the average of the squared differences between the logarithmic values of the predicted and actual values.
The formula for MSLE can be expressed as:
MSLE = (1/n) * Σ (log(1 + y_true) – log(1 + y_pred))²
where:
- y_true represents the actual values.
- y_pred represents the predicted values.
- n is the number of observations.
By taking the logarithm of the values, MSLE can effectively handle skewed distributions and is particularly useful in cases where we want to penalize underestimations more than overestimations. This property makes MSLE suitable for situations where the predicted values can be zero or where the scale of the data varies widely.
MSLE also has advantages in interpretability, as it measures the relative difference between the actual and predicted values. A lower MSLE indicates a better fit of the model to the data, while a higher MSLE signifies a poorer model performance. In practice, MSLE is often preferred over Mean Squared Error (MSE) when dealing with exponential growth scenarios or when the predictions are expected to be on a logarithmic scale.