Files
gps-denied-onboard/_docs/02_components/helpers/h03_robust_kernels_spec.md
T
Oleksandr Bezdieniezhnykh abc26d5c20 initial structure implemented
docs -> _docs
2025-12-01 14:20:56 +02:00

1.5 KiB

Robust Kernels Helper

Interface Definition

Interface Name: IRobustKernels

Interface Methods

class IRobustKernels(ABC):
    @abstractmethod
    def huber_loss(self, error: float, threshold: float) -> float:
        pass
    
    @abstractmethod
    def cauchy_loss(self, error: float, k: float) -> float:
        pass
    
    @abstractmethod
    def compute_weight(self, error: float, kernel_type: str, params: Dict[str, float]) -> float:
        pass

Component Description

Huber/Cauchy loss functions for outlier rejection in optimization.

API Methods

huber_loss(error: float, threshold: float) -> float

Description: Huber robust loss function.

Formula:

if |error| <= threshold:
    loss = 0.5 * error^2
else:
    loss = threshold * (|error| - 0.5 * threshold)

Purpose: Quadratic for small errors, linear for large errors (outliers).


cauchy_loss(error: float, k: float) -> float

Description: Cauchy robust loss function.

Formula:

loss = (k^2 / 2) * log(1 + (error/k)^2)

Purpose: More aggressive outlier rejection than Huber.


compute_weight(error: float, kernel_type: str, params: Dict[str, float]) -> float

Description: Computes robust weight for error.

Usage: Factor Graph applies weights to downweight outliers.

Dependencies

External: numpy

Test Cases

  1. Small error → weight ≈ 1.0
  2. Large error (350m outlier) → weight ≈ 0.1 (downweighted)
  3. Huber vs Cauchy → Cauchy more aggressive