xnn.common.benchmark.metrics.score#

xnn.common.benchmark.metrics.score(pairs, metrics)[source]#

Reduce prediction/target pairs to a flat {target_metric: value} map.

Parameters:
  • pairs (dict of str to (Tensor, Tensor)) – Prediction/target pairs keyed by target, as returned by collect_predictions().

  • metrics (dict of str to list of str, or list of str) – Which metric is reported for which target: a mapping from target to registered metric names (the canonical metrics form; targets absent from the mapping are skipped), or a plain list of names applied to every target in pairs.

Returns:

One entry per scored (target, metric) combination, keyed f"{target}_{metric}" (e.g. "energy_mae", "forces_rmse").

Return type:

dict of str to float