Metrics

class metatensor.models.utils.metrics.RMSEAccumulator[source]

Bases: object

Accumulates the RMSE between predictions and targets for an arbitrary number of keys, each corresponding to one target.

Initialize the accumulator.

update(predictions: Dict[str, TensorMap], targets: Dict[str, TensorMap])[source]

Updates the accumulator with new predictions and targets.

Parameters:
  • predictions (Dict[str, TensorMap]) – A dictionary of predictions, where the keys correspond to the keys in the targets dictionary, and the values are the predictions.

  • targets (Dict[str, TensorMap]) – A dictionary of targets, where the keys correspond to the keys in the predictions dictionary, and the values are the targets.

finalize(not_per_atom: List[str]) Dict[str, float][source]

Finalizes the accumulator and return the RMSE for each key.

All keys will be returned as “{key} RMSE (per atom)” in the output dictionary, unless key contains one or more of the strings in not_per_atom, in which case “{key} RMSE” will be returned.

Parameters:

not_per_atom (List[str])

Return type:

Dict[str, float]