orcanet.lib.losses
OrcaNet custom loss functions.
Module Contents
Functions
|
Normal distribution using tfp. See lkl_normal. |
|
Negative normal log-likelihood function for n regression output neurons |
Attributes
- orcanet.lib.losses.lkl_normal_tfp(y_true, y_pred)[source]
Normal distribution using tfp. See lkl_normal.
- orcanet.lib.losses.lkl_normal(y_true, y_pred)[source]
Negative normal log-likelihood function for n regression output neurons with clipping for increased stability.
For stability in the case of outliers, the loss l_i is capped at a maximum of 10 * |pred_i - true_i| for each sample.
- Parameters
- y_truetf.Tensor
Shape (bs, 2, n) or (bs, 2). y_true[:, 0] is the label of shape (bs, n) (true), and y_true[:, 1] is not used (necessary as tf 2.1 requires y_true and y_pred to have same shape).
- y_predtf.Tensor
Shape (bs, 2, n) or (bs, 2). The output of the network. y_pred[:, 0] is mu, and y_pred[:, 1] is sigma.