MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ComputePrimalLoss

Method ComputePrimalLoss

tensorflow/core/kernels/hinge-loss.h:89–93  ·  view source on GitHub ↗

Hinge loss for binary classification for a single example. Hinge loss equals max(0, 1 - y * wx) (see https://en.wikipedia.org/wiki/Hinge_loss). For weighted instances loss should be multiplied by the instance weight.

Source from the content-addressed store, hash-verified

87 // equals max(0, 1 - y * wx) (see https://en.wikipedia.org/wiki/Hinge_loss).
88 // For weighted instances loss should be multiplied by the instance weight.
89 double ComputePrimalLoss(const double wx, const double example_label,
90 const double example_weight) const final {
91 const double y_wx = example_label * wx;
92 return std::max(0.0, 1 - y_wx) * example_weight;
93 }
94
95 double PrimalLossDerivative(const double wx, const double label,
96 const double example_weight) const final {

Callers 2

TESTFunction · 0.45
DoComputeFunction · 0.45

Calls 1

maxFunction · 0.50

Tested by 1

TESTFunction · 0.36