validation and profiles

This commit is contained in:
Miha Kralj
2026-02-26 22:02:52 -08:00
parent 9ab37c1200
commit 8a1ba95173
317 changed files with 18704 additions and 622 deletions
+14
View File
@@ -69,6 +69,20 @@ $$T_{total} = T_{between} + \sum_k \frac{n_k}{n} \cdot \frac{\mu_k}{\mu} \cdot T
## Performance Profile
### Operation Count (Streaming Mode)
Theil-Sen slope estimates the median of all pairwise slopes — O(N^2) per bar for exact computation.
| Operation | Count | Cost (cycles) | Subtotal |
| :--- | :---: | :---: | :---: |
| Ring buffer add/evict | 1 | 3 cy | ~3 cy |
| Compute N*(N-1)/2 pairwise slopes | N^2/2 | 3 cy | ~1.5N^2 cy |
| Sort slopes for median | N^2/2 log(N^2/2) | 2 cy | ~N^2 log N cy |
| Extract median | 1 | 1 cy | ~1 cy |
| **Total (N=20)** | **O(N^2 log N)** | — | **~7000 cy** |
O(N^2 log N) per update — expensive for N > 30. Use only where robustness to outliers justifies compute cost. Batch pre-computation strongly preferred for historical analysis.
| Operation | Complexity | Notes |
|-----------|------------|-------|
| Update (streaming) | O(n) | Two passes: mean then Theil sum |