ClassificationLoss
interfacein packageklyn.math.nn.losses
public interface ClassificationLoss<T extends AbstractFloat = Float> extends SupervisedLoss<T, Int>
ClassificationLoss

Mean classification loss with integer target labels. compute(logits, labels, gradientScale) returns a mean loss and its mean-reduced output derivative, without input mutation. Logits have shape [samples, classes], labels [samples]; the positive finite gradientScale multiplies only the derivative and defaults to one.

Example

loss as ClassificationLoss<Float> = SparseCategoricalCrossentropy<Float>()

Methods
Modifier and Type Member Description
public override compute
compute(logits as NDArray<T>, labels as NDArray<Int>, gradientScale as Double = 1.0) as LossResult<T>
Computes mean loss and its mean-reduced output derivative.