Category: 07. Losses

  • Hinge losses for “maximum-margin” classification

    Hinge class Computes the hinge loss between y_true & y_pred. Formula: y_true values are expected to be -1 or 1. If binary (0 or 1) labels are provided we will convert them to -1 or 1. Arguments SquaredHinge class Computes the squared hinge loss between y_true & y_pred. Formula: y_true values are expected to be -1 or 1. If binary (0 or 1) labels are…

  • Regression losses

    MeanSquaredError class Computes the mean of squares of errors between labels and predictions. Formula: Arguments MeanAbsoluteError class Computes the mean of absolute difference between labels and predictions. Formula: Arguments MeanAbsolutePercentageError class Computes the mean absolute percentage error between y_true & y_pred. Formula: Arguments MeanSquaredLogarithmicError class Computes the mean squared logarithmic error between y_true & y_pred. Formula: Arguments CosineSimilarity class Computes the cosine similarity between y_true & y_pred. Note that…

  • Probabilistic losses

    BinaryCrossentropy class Computes the cross-entropy loss between true labels and predicted labels. Use this cross-entropy loss for binary (0 or 1) classification applications. The loss function requires the following inputs: Arguments Examples Recommended Usage: (set from_logits=True) With compile() API: As a standalone function: Default Usage: (set from_logits=False) BinaryFocalCrossentropy class Computes focal cross-entropy loss between true labels and predictions. Binary cross-entropy loss is often…