Categorical cross-entropy loss

The cross-entropy operation computes the categorical cross-entropy loss between network predictions and target values for multiclass classification problems.

The loss is calculated using the following formula

$$\text{loss}=-\frac{1}{N}{\displaystyle \sum _{i=1}^{M}{T}_{i}\mathrm{log}({X}_{i})}$$

where *X _{i}* is the network response,

This function computes the cross-entropy loss between predictions and targets stored as
`dlarray`

data. If
you want to calculate the cross-entropy loss within a `layerGraph`

object
or `Layer`

array for use
with `trainNetwork`

, use the following layer:

computes the categorical cross-entropy loss between the predictions `dlY`

= crossentropy(`dlX`

,`targets`

)`dlX`

and the target values `targets`

for multiclass classification problems. The
input `dlX`

is a formatted `dlarray`

with dimension
labels. The output `dlY`

is an unformatted scalar
`dlarray`

with no dimension labels.

`dlarray`

| `dlfeval`

| `dlgradient`

| `mse`

| `softmax`