Show / Hide Table of Contents

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.

Inheritance
System.Object
BaseLoss
CategoricalCrossentropy
Inherited Members
BaseLoss.Name
Namespace: SiaNet.Losses
Assembly: SiaNet.dll
Syntax
public class CategoricalCrossentropy : BaseLoss

Constructors

| Improve this Doc View Source

CategoricalCrossentropy(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 true [from logit].

Properties

| Improve this Doc View Source

FromLogit

Gets or sets a value indicating whether [from logit].

Declaration
public bool FromLogit { get; set; }
Property Value
Type Description
System.Boolean

true if [from logit]; otherwise, false.

Methods

| Improve this Doc View Source

Backward(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
BaseLoss.Backward(Tensor, Tensor)
| Improve this Doc View Source

Forward(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
Overrides
BaseLoss.Forward(Tensor, Tensor)

See Also

BaseLoss
  • Improve this Doc
  • View Source
Back to top Generated by DocFX