πŸŽ‰ 75% of content is free forever β€” Unlock Premium from $10/mo β†’
CW
Search courses…
πŸ’Ό Servicesℹ️ Aboutβœ‰οΈ ContactView Pricing Plansfrom $10

Loss Functions: Design and Optimization

Machine LearningLoss Functions: Design and Optimization🟒 Free Lesson

Advertisement

Loss Functions: Design and Optimization

Module: Machine Learning | Difficulty: Advanced

Exponential Family Loss

Proper Scoring Rules

A scoring rule is proper if for all .

| Loss | Formula | Proper | Robust | |------|---------|--------|--------| | Squared | | Yes | No | | Log | | Yes | No | | Hinge | | No | Yes | | Huber | Mixed | No | Yes |

Huber Loss

Focal Loss

import numpy as np

class HuberLoss:
    def __init__(self, delta=1.0):
        self.delta = delta
    def loss(self, y, f):
        err = y - f
        is_small = np.abs(err) <= self.delta
        return np.where(is_small, 0.5*err**2, self.delta*np.abs(err) - 0.5*self.delta**2)
    def gradient(self, y, f):
        err = y - f
        is_small = np.abs(err) <= self.delta
        return np.where(is_small, -err, -self.delta*np.sign(err))

Research Insight: Focal loss was designed for class imbalance. The term down-weights easy examples, forcing the model to focus on hard examples. works best for most applications.

Need Expert Machine Learning Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement