xnn.common.train.reactions.reaction_energy_loss#

xnn.common.train.reactions.reaction_energy_loss(species_energy, stoichiometry, reference, weight=None, scale=None, huber_delta=0.0)[source]#

The weighted mean of the squared errors of reaction energies.

Parameters:
  • species_energy (Tensor) – Predicted energies of the species (S,).

  • stoichiometry (Tensor) – Signed coefficients (R, S) of the species in each reaction.

  • reference (Tensor) – Reference reaction energies (R,) in the units of species_energy.

  • weight (Tensor, optional) – Weights of the reactions in the mean (R,); default equal.

  • scale (Tensor, optional) – Factors of the errors before squaring (R,); default 1.

  • huber_delta (float, optional) – > 0 makes the residual a Huber function of the scaled error with this threshold (as in weighted_loss()).

Returns:

The loss (a scalar), differentiable in species_energy.

Return type:

Tensor