Table of Contents

Class Loss<TPrediction>

Namespace
NeuralNetworks.Losses
Assembly
NeuralNetworks.dll

The "loss" of a neural network.

public abstract class Loss<TPrediction>

Type Parameters

TPrediction
Inheritance
Loss<TPrediction>
Derived
Inherited Members

Properties

Prediction

public TPrediction Prediction { get; }

Property Value

TPrediction

Target

protected TPrediction Target { get; }

Property Value

TPrediction

Methods

Backward()

Computes gradient of the loss value with respect to the input to the loss function.

public TPrediction Backward()

Returns

TPrediction

CalculateLoss()

protected abstract float CalculateLoss()

Returns

float

CalculateLossGradient()

protected abstract TPrediction CalculateLossGradient()

Returns

TPrediction

Clone()

public Loss<TPrediction> Clone()

Returns

Loss<TPrediction>

CloneBase()

protected virtual Loss<TPrediction> CloneBase()

Returns

Loss<TPrediction>

EnsureSameShape(TPrediction?, TPrediction)

[Conditional("DEBUG")]
protected abstract void EnsureSameShape(TPrediction? prediction, TPrediction target)

Parameters

prediction TPrediction
target TPrediction

Forward(TPrediction, TPrediction)

Computes the actual loss value

public float Forward(TPrediction prediction, TPrediction target)

Parameters

prediction TPrediction
target TPrediction

Returns

float