Accuracy
Score a baseline method on non-event days: bias, RMSE and relative RMSE in basis points, computed exactly with integers.On this page
Whether a method is fair for a kind of site is a question of data. accuracy::score answers it on non-event days: compute the baseline as if an event had happened, and compare it with what the site actually did.
It measures and decides nothing. Accepting a method is the grid operator's decision.
The metrics#
With error e = baseline − actual per ISP, over n ISPs:
| Field | Definition |
|---|---|
count | n, the ISPs scored |
bias | round(Σe / n), half away from zero, as a Deviation. Positive means the method over-estimates. |
rmse | ⌊√(⌊Σe² / n⌋)⌋, an integer square root, as a Power floored to the watt |
rrmse_basis_points | round(RMSE · 10 000 · n / Σ actual): RMSE relative to the mean actual, in basis points (100 = 1 %). None when Σ actual is not positive. |
No floating point is involved: the sums are i128/u128, and every division and the square root are named and exact.
Scoring#
score takes (baseline, actual) pairs, each pair on one grid. Pass one pair per pseudo-event day; the metrics are over all ISPs together.
use flexibility::jiff::{Timestamp, tz::TimeZone};
use flexibility::{accuracy, kw, Grid, IspDuration, Series};
let grid = Grid::new(Timestamp::UNIX_EPOCH, IspDuration::FIFTEEN_MINUTES, 3, TimeZone::UTC)?;
let baseline = Series::filled(grid.clone(), kw!(10));
let actual = Series::new(grid, vec![kw!(9), kw!(10), kw!(11)])?;
let score = accuracy::score([(&baseline, &actual)])?;
assert_eq!(score.bias.watts(), 0);
assert_eq!(score.rmse.watts(), 816); // ⌊√(2/3) kW⌋
assert_eq!(score.rrmse_basis_points, Some(816));With real data, compute each day's baseline with the method under review (for example baseline::mbma over a window where no event happened), cut the day's measurement to the same ISPs with Series::over, and pass the pairs:
let pairs: Vec<_> = baselines.iter().map(|b| b.series()).zip(actuals.iter()).collect();
let score = accuracy::score(pairs)?;No pairs, or pairs with no ISPs, is Error::NoData; a pair on two grids is Error::GridMismatch.
Reading the result#
- Bias is the systematic error. A method with positive bias pays for flexibility that was not delivered.
- RMSE is the typical size of the error in watts; RRMSE puts it relative to the site's consumption, so sites of different size can be compared.
dprognosis@1has no defence against a high prognosis in the method itself. Scoring the aggregator's prognoses against metered non-event days is how a DSO watches it.