Class CategoricalCrossentropy
Cross-entropy loss, or log loss, measures the performance of a classification model whose output is a probability value between 0 and 1. Cross-entropy loss increases as the predicted probability diverges from the actual label.
Inherited Members
Namespace: SiaNet.Losses
Assembly: SiaNet.dll
Syntax
public class CategoricalCrossentropy : BaseLoss
Constructors
| Improve this Doc View SourceCategoricalCrossentropy(Boolean)
Initializes a new instance of the CategoricalCrossentropy class.
Declaration
public CategoricalCrossentropy(bool fromLogit = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | fromLogit | if set to |
Properties
| Improve this Doc View SourceFromLogit
Gets or sets a value indicating whether [from logit].
Declaration
public bool FromLogit { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
| Improve this Doc View SourceBackward(Tensor, Tensor)
Backpropagation method to calculate gradient of the loss function
Declaration
public override Tensor Backward(Tensor preds, Tensor labels)
Parameters
Type | Name | Description |
---|---|---|
Tensor | preds | The predicted result. |
Tensor | labels | The true result. |
Returns
Type | Description |
---|---|
Tensor |
Overrides
| Improve this Doc View SourceForward(Tensor, Tensor)
Forwards the inputs and calculate the loss.
Declaration
public override Tensor Forward(Tensor preds, Tensor labels)
Parameters
Type | Name | Description |
---|---|---|
Tensor | preds | The predicted result. |
Tensor | labels | The true result. |
Returns
Type | Description |
---|---|
Tensor |