Great question! You want a certainty/confidence metric that:
- Is 1 if all models predict the exact same value.
- Recognizes that close values (e.g., [64, 65, 66, 67, 68, 69]) indicate high agreement, just like a close cluster at a different scale (e.g., [14, 15, 16, 17, 18, 19]).
- Is variable-agnostic (works for any variable without tuning).
Step 1: Understand the problem
You have 6 model predictions per variable per time step:
[
x = [x_1, x_2, x_3, x_4, x_5, x_6]
]
You want a score ( S \in [0,1] ) where:
- ( S = 1 ) if all ( x_i ) are identical.
- ( S ) decreases as the spread of ( x_i ) increases.
- The metric should be scale-invariant (so it works for temperature, wind speed, humidity, etc.).
Step 2: Key insight — use a relative dispersion measure
Absolute differences don’t work because the scale varies by variable. Instead, use a relative measure of spread.
Two common relative dispersion measures:
- Coefficient of Variation (CV): ( \text{CV} = \frac{\sigma}{|\mu|} )
- Normalized Range: ( \frac{\max(x) - \min(x)}{|\mu|} )
Where:
- ( \mu = \text{mean}(x) )
- ( \sigma = \text{standard deviation}(x) )
Step 3: Define the metric
Option A: Using Coefficient of Variation (CV)
[
S = \max\left(0, 1 - \frac{\sigma}{|\mu| + \epsilon}\right)
]
- ( \epsilon ) is a small number to avoid division by zero (e.g., (10^{-6})).
- If all values are identical, (\sigma = 0 \Rightarrow S = 1).
- If values are very spread out, (\sigma) grows, (S) approaches 0.
- This is scale-invariant because (\sigma) and (\mu) scale together.
Option B: Using Normalized Range
[
S = \max\left(0, 1 - \frac{\max(x) - \min(x)}{|\mu| + \epsilon}\right)
]
- Similar logic, but uses range instead of std dev.
- Range is sensitive to outliers, std dev is more robust.
Step 4: Why this works
- Scale invariance: Dividing by mean normalizes the spread relative to the magnitude of the variable.
- Bounded: (S) is clipped to [0,1].
- Intuitive: Perfect agreement → zero spread → score 1.
- General: Works for any variable with positive or negative values (mean magnitude in denominator).
Step 5: Handling zero or near-zero means
If (\mu \approx 0), dividing by (|\mu|) is unstable. Use:
[
S = \max\left(0, 1 - \frac{\sigma}{\max(|\mu|, \delta)}\right)
]
where (\delta) is a small threshold (e.g., 1 or a small fraction of typical variable magnitude).
Step 6: Example
-
(x = [64, 65, 66, 67, 68, 69])
- (\mu = 66.5), (\sigma \approx 1.87)
- (S = 1 - \frac{1.87}{66.5} \approx 0.972)
-
(x = [14, 15, 16, 17, 18, 19])
- (\mu = 16.5), (\sigma \approx 1.87)
- (S = 1 - \frac{1.87}{16.5} \approx 0.886)
The second is slightly lower because the relative spread is larger compared to the mean, but both are high scores indicating good agreement.
Step 7: Classification of scores
| Score (S) | Agreement Level |
|---|
| (0.85 \leq S \leq 1) | Good agreement |
| (0.5 \leq S < 0.85) | Moderate agreement |
| (S < 0.5) | Poor agreement |
Summary
Certainty/confidence metric:
[
\boxed{
S = \max\left(0, 1 - \frac{\sigma}{\max(|\mu|, \delta)}\right)
}
]
- (\sigma) = standard deviation of model predictions
- (\mu) = mean of model predictions
- (\delta) = small positive constant to avoid division by zero (e.g., 1)
Interpretation:
- (S=1) means perfect agreement.
- (S) close to 1 means models agree closely relative to the variable scale.
- (S) near 0 means poor agreement.
If you want, I can help you implement this in code or extend it to handle special cases!