Loss Layers

Layer

Description

CategoricalAccuracy

0-1 loss function

CrossEntropy

Cross entropy between probability vectors

L1Norm

L1 vector norm

L2Norm2

Square of L2 vector norm

MeanAbsoluteError

Mean absolute error

MeanSquaredError

Mean squared error

TopKCategoricalAccuracy

Top-k prediction scores


CategoricalAccuracy

The CategoricalAccuracy Layer is a 0-1 loss function.

Requires two inputs, which are respectively interpreted as prediction scores and as a one-hot label vector. The output is one if the top entries in both inputs are in the same position and is otherwise zero. Ties are broken in favor of entries with smaller indices.

This is primarily intended for use as a metric since it is not differentiable.

Arguments: None

Back to Top


CrossEntropy

The CrossEntropy layer measures the probability and error between vectors.

Given a predicted distribution \(y\) and ground truth distribution \(\hat{y}\),

\[CE(y,\hat{y}) = - \sum\limits_{i} \hat{y}_i \log y_i\]

Arguments:

use_labels

(bool) Advanced option for distconv

Back to Top


L1Norm

The L1Norm layer is the L1 norm of a vector.

\[\lVert x\rVert_1 = \sum\limits_{i} | x_i |\]

Arguments: None

Back to Top


L2Norm2

The L2Norm2 layer is the square of L2 vector norm.

\[\lVert x\rVert_2^2 = \sum\limits_{i} x_i^2\]

Arguments: None

Back to Top


MeanAbsoluteError

The MeanAbsoluteError given a prediction \(y\) and ground truth \(\hat{y}\):

\[MAE(y,\hat{y}) = \frac{1}{n} \sum\limits_{i=1}^{n} | y_i - \hat{y}_i |\]

Arguments: None

Back to Top


MeanSquaredError

The MeanSquaredError layer given a prediction \(y\) and ground truth \(\hat{y}\):

\[MSE(y,\hat{y}) = \frac{1}{n} \sum\limits_{i=1}^{n} (y_i - \hat{y}_i)^2\]

Arguments: None

Back to Top


TopKCategoricalAccuracy

The TopKCategoricalAccuracy layer requires two inputs, which are respectively interpreted as prediction scores and as a one-hot label vector. The output is one if the corresponding label matches one of the top-k prediction scores and is otherwise zero. Ties in the top-k prediction scores are broken in favor of entries with smaller indices.

Arguments:

k

(int64)

Back to Top