LostTech.TensorFlow : API Documentation

Type SquaredHinge

Namespace tensorflow.keras.losses

Parent LossFunctionWrapper

Interfaces ISquaredHinge

Computes the squared hinge loss between `y_true` and `y_pred`.

`loss = square(maximum(1 - y_true * y_pred, 0))`

`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.

Usage: Usage with the `compile` API:
Show Example
sh = tf.keras.losses.SquaredHinge()
            loss = sh([-1., 1., 1.], [0.6, -0.7, -0.5]) 

# loss = (max(0, 1 - y_true * y_pred))^2 = [1.6^2 + 1.7^2 + 1.5^2] / 3

print('Loss: ', loss.numpy()) # Loss: 2.566666

Properties

Public properties

object fn get; set;

string name get; set;

object PythonObject get;

string reduction get; set;