FScoreLoss

class ketos.neural_networks.dev_utils.losses.FScoreLoss(beta=1.0, **kwargs)[source]

Loss function based on the inverse of F-Score.

When instantiated, the resulting loss function expects the predictions in the ‘y_pred’ argument and the true labels in the ‘y_true’ argument.

Args:
beta:float

The relative weight of recall in relation to precision.

Examples:

If beta = 1.0, recall has same weight as precision If beta = 0.5, recall has half the weight of precision If beta = 2.0, recall has twice the weight of precision

Methods

call(y_true, y_pred)

Invokes the Loss instance.

call(y_true, y_pred)[source]

Invokes the Loss instance.

Args:
y_true: Ground truth values.

shape = [batch_size, d0, .. dN], except sparse loss functions such as sparse categorical crossentropy where shape = [batch_size, d0, .. dN-1]

y_pred: The predicted values.

shape = [batch_size, d0, .. dN]

Returns:

Loss values with the shape [batch_size, d0, .. dN-1].