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 ofspecies_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) –
> 0makes the residual a Huber function of the scaled error with this threshold (as inweighted_loss()).
- Returns:
The loss (a scalar), differentiable in
species_energy.- Return type:
Tensor