Huber — One of the most robust loss function against outliers and overfitting.

Deepsutariya
2 min readJun 16, 2024

--

Are you battling overfitting or dealing with pesky outliers in your neural networks? Have you tweaked everything from the number of epochs to the model architecture, but nothing seems to work? Or are you a beginner eager to dive into the fascinating world of AI/ML? If so, I have a fantastic solution for you — and it’s lemon juice (just kidding)! It’s the Huber Loss Function.

Many people might not be familiar with this elegant and powerful loss function, so let’s break it down.

What is Huber Loss?

The Huber loss function beautifully combines the strengths of Mean Absolute Error (MAE) and Mean Squared Error (MSE). If you’re not sure about MAE and MSE, check out the resources linked below.

Why Huber Loss Excels

Huber loss is particularly effective because it acts as a hybrid:

  • Quadratic (like MSE) when the error is small, which helps the model converge quickly and accurately.
  • Linear (like MAE) when the error is large, making it robust against outliers.

This combination allows Huber loss to handle outliers gracefully while maintaining high precision in general training scenarios.

The Huber Loss Formula

Here’s the formula for Huber loss:

where (a) is the difference between the predicted and actual values, and (\delta) is a threshold parameter.

So, if you’re looking to improve your model’s performance and mitigate the effects of outliers and overfitting, give the Huber loss function a try!

if you like the article follow me on medium

Key Resources:

By using the Huber loss function, you can strike a perfect balance in your model’s training process. Happy experimenting!

--

--