mirror of
https://github.com/azaion/gps-denied-desktop.git
synced 2026-04-23 03:26:37 +00:00
initial structure implemented
docs -> _docs
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
# Robust Kernels Helper
|
||||
|
||||
## Interface Definition
|
||||
|
||||
**Interface Name**: `IRobustKernels`
|
||||
|
||||
### Interface Methods
|
||||
|
||||
```python
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user