Show / Hide Table of Contents

Class CosineProximity

Cosine Proximity loss function computes the cosine proximity between predicted value and actual value. It is same as Cosine Similarity, which is a measure of similarity between two non-zero vectors of an inner product space that measures the cosine of the angle between them. In this case, note that unit vectors are maximally “similar” if they’re parallel and maximally “dissimilar” if they’re orthogonal (perpendicular). This is analogous to the cosine, which is unity (maximum value) when the segments subtend a zero angle and zero (uncorrelated) when the segments are perpendicular.

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

Constructors

| Improve this Doc View Source

CosineProximity()

Initializes a new instance of the CosineProximity class.

Declaration
public CosineProximity()

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