peal.training.criterions¶
Loss functions (“criterions”) used by PEAL’s predictor trainers.
A criterion is a callable criterion(model, y_pred, y_target, latent_code)
returning a scalar tensor. model is passed so a criterion can read the
training config (model.config.task / model.config.data) or, for the
weight regularisers, iterate over the parameters. ModelTrainer.run_epoch
looks every key of config.task.criterions up in available_criterions
and sums the results weighted by the configured factors. l1, l2 and
orthogonality are weight regularisers; the others are data losses.
Functions
Cross-entropy for hard or soft targets. |
|
Cross-entropy between logits and a soft (one-hot or mixed) target. |
|
Focal loss on every output column. |
|
Select the criterions named in |
|
Mean absolute value over all parameters of |
|
Mean squared value over all parameters of |
|
Mixup in the penultimate feature space (latent-convexity regulariser). |
|
BCE on the discrete outputs plus weighted MSE on the continuous ones. |
|
Focal loss on the discrete outputs plus weighted MSE on the continuous. |
|
Penalise non-orthogonal weight matrices of |
Classes
Binary focal loss on logits (Lin et al., 2017). |
|
Callable wrapper around |