HingeLoss

class HingeLoss @JvmOverloads constructor(margin: Float = 1.0f) : Loss(source)

Hinge Loss for SVM-style classification.

Hinge(pred, target) = max(0, margin - target * pred)

Targets should be in {-1, +1} for binary classification. The loss is 0 when the prediction has the correct sign and magnitude > margin.

Parameters

margin

The margin parameter. Default is 1.0.

Constructors

Link copied to clipboard
constructor(margin: Float = 1.0f)

Functions

Link copied to clipboard
open override fun <T : DType, V> forward(preds: Tensor<T, V>, targets: Tensor<out DType, *>, ctx: ExecutionContext, reduction: Reduction): Tensor<T, V>