terminator.utils.model.loss_fn

Loss functions for TERMinator, and a customizable loss function constructor built from the included components.

In order to use the customizable loss function constructor construct_loss_fn, loss functions must have the signature loss(etab, E_idx, data), where

  • loss is the name of the loss fn

  • etab is the outputted etab from TERMinator

  • E_idx is the edge index outputted from TERMinator

  • data is the training data dictionary

Additionally, the function must return two outputs loss_contribution, norm_count, where
  • loss_contribution is the computed loss contribution by the function

  • norm_count is a normalizing constant associated with the loss (e.g. when averaging across losses in batches,

the average loss will be \(\frac{\sum_i loss_contribution}{\sum_i norm_count}\))

Functions

construct_loss_fn(hparams)

Construct a combined loss function based on the inputted hparams

etab_l1_norm_penalty(etab, E_idx, data)

Take the norm of all etabs and scale it by the total number of residues involved

etab_norm_penalty(etab, E_idx, data)

Take the norm of all etabs and scale it by the total number of residues involved

mindren_etab_norm_penalty(etab, E_idx, data)

Take the norm of all etabs and scale it by the total number of residues involved

nlcpl(etab, E_idx, data)

Negative log composite psuedo-likelihood Averaged nlcpl per residue, across batches p(a_i,m ; a_j,n) = softmax [ E_s(a_i,m) + E_s(a_j,n) + E_p(a_i,m ; a_j,n) + sum_(u != m,n) [ E_p(a_i,m; A_u) + E_p(A_u, a_j,n) ] ]

nlcpl_full(etab, E_idx, data)

Negative log composite psuedo-likelihood Averaged nlcpl per residue, across batches p(a_i,m ; a_j,n) =

nlcpl_test(etab, E_idx, data)

Alias of nlcpl_full

nlpl(etab, E_idx, data)

Negative log psuedo-likelihood Returns negative log psuedolikelihoods per residue, with padding residues masked

pair_self_energy_ratio(etab, E_idx, data)

Return the ratio of the scaled norm of pair energies vs self energies in an etab

sortcery_loss(etab, E_idx, data)

Compute the mean squared error between the etab's predicted energies for peptide-protein complexes and experimental energies derived from SORTCERY.