mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-02 19:37:43 +00:00
33d20f2a18
Complete thin Dx-composition wrapper indicators with full test coverage: - PlusDi/MinusDi: Directional Indicator wrappers (DiPlus/DiMinus from Dx) - PlusDm/MinusDm: Directional Movement wrappers (DmPlus/DmMinus from Dx) - Individual validation tests per indicator directory (TALib, Skender, bounds) - Combined unit tests (DiDm.Tests.cs) and validation tests (DiDm.Validation.Tests.cs) - Quantower wrappers + tests for all 4 indicators - PineScript v6 implementations with compensated RMA - Normalized .md documentation for all indicators and categories - 182 tests passing, 0 failures
3.0 KiB
3.0 KiB
RMSE: Root Mean Squared Error
MSE's more interpretable sibling that speaks the language of your data.
| Property | Value |
|---|---|
| Category | Error Metric |
| Inputs | Actual, Predicted (dual series) |
| Parameters | period |
| Outputs | Single series (RMSE) |
| Output range | \geq 0 |
| Warmup | period bars |
| PineScript | rmse.pine |
- Root Mean Squared Error (RMSE) is the square root of MSE, providing an error metric in the same units as the original data while retaining sensitiv...
- Parameterized by
period. - Output range:
\geq 0. - Requires 1 bar of warmup before first valid output (IsHot = true).
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Root Mean Squared Error (RMSE) is the square root of MSE, providing an error metric in the same units as the original data while retaining sensitivity to large errors.
Mathematical Foundation
Formula
RMSE = \sqrt{\frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2} = \sqrt{MSE}
Properties
- Non-negative: RMSE ≥ 0
- Same units: Unlike MSE, RMSE is in original data units
- Outlier sensitive: Inherits MSE's penalty for large errors
- Always ≥ MAE: RMSE ≥ MAE due to Jensen's inequality
Usage
var rmse = new Rmse(period: 20);
var result = rmse.Update(actualValue, predictedValue);
// Batch calculation
var results = Rmse.Calculate(actualSeries, predictedSeries, period: 20);
Performance Profile
Operation Count (Streaming Mode)
O(1) per bar. Single-pass scalar transformation of (actual, forecast) pair; no lookback window required.
| Operation | Count | Cost (cycles) | Subtotal |
|---|---|---|---|
| Error computation (subtract, abs/square/log) | 1-3 | ~3-8 cy | ~5-15 cy |
| Running accumulator update (EMA or sum) | 1 | ~4 cy | ~4 cy |
| Total | 2-4 | — | ~9-19 cycles |
Streaming update requires only the current actual/forecast pair and running state. ~10-15 cycles/bar typical.
Batch Mode (SIMD Analysis)
| Operation | Vectorizable? | Notes |
|---|---|---|
| Element-wise error computation | Yes | Independent per bar; fully vectorizable with Vector<double> |
| Reduction (sum/mean) | Yes | Parallel reduction; AVX2 gives 4x speedup |
| Log/exp components | Partial | Transcendental ops; polynomial approx for SIMD |
Batch SIMD: 4x-8x speedup for large windows. ~3-5 cy/bar amortized in vectorized batch mode.
| Metric | Score | Notes |
|---|---|---|
| Throughput | ~15 ns/bar | O(1) with sqrt operation |
| Allocations | 0 | Pre-allocated ring buffer |
| Complexity | O(1) | Constant time per update |