Cross-entropy loss for classification tasks
The cross-entropy operation computes the cross-entropy loss between network predictions and target values for single-label and multi-label classification tasks.
Note
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 single-label classification tasks. The
input dlX
is a formatted dlarray
with dimension
labels. The output dlY
is an unformatted scalar
dlarray
with no dimension labels.
specifies options using one or more name-value pair arguments in addition to the input
arguments in previous syntaxes. For example,
dlY
= crossentropy(___,Name,Value
)'TargetCategories','independent'
computes the cross-entropy loss for a
multi-label classification task.
dlarray
| dlfeval
| dlgradient
| mse
| softmax