Data-oriented metrics¶
Let \(y_i\) denote target values, \(\hat y_i\) predictions, and \(N\) the number of evaluated values after masking.
Mean squared error¶
- Range: \([0,\infty)\)
- Best value: \(0\)
- Lower is better.
Root mean squared error¶
RMSE has the same units as the predicted field and emphasizes large errors.
Mean absolute error¶
MAE is less sensitive to isolated large errors than RMSE.
Maximum absolute error¶
This reports the worst evaluated point.
Relative \(L_1\) and \(L_2\)¶
The realpdebench suite uses the mean of the per-sample relative \(L_2\) values:
NMSE and NRMSE¶
These are scale-normalized, but the exact normalization must be stated when comparing external benchmarks.
Coefficient of determination¶
- Best value: \(1\)
- Higher is better.
- Values below zero indicate that the predictor is worse than the target mean under this aggregation.
Pearson correlation¶
It measures linear association and does not by itself measure calibration or magnitude accuracy.
Cosine similarity¶
Useful for profile or directional agreement, but insensitive to uniform amplitude scaling.
Variance-scaled errors¶
For field/channel \(c\) with variance \(\sigma_c^2\):
NAVIER-CFD uses provider-supplied field variance when available; otherwise it estimates variance from the target array. Record which source was used.
Update Ratio¶
For simulated pretraining followed by real-data finetuning:
where \(N_1\) is the number of finetuning updates and \(N_2\) the number of scratch-training updates required to reach the best scratch-training RMSE.
- Lower is better.
- Values below \(1\) indicate that pretraining reduced the number of updates.
- This metric is valid only when the target performance threshold and update-count protocol are identical.
API¶
from navier_cfd import MetricContext, MetricSuite
results = MetricSuite.from_name("data_standard").evaluate(
prediction,
target,
context=MetricContext(mask=fluid_mask),
)