MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / hng_loss

Function hng_loss

src/machine_learning/loss_function/hinge_loss.rs:16–23  ·  view source on GitHub ↗

# Hinge Loss The `hng_loss` function calculates the Hinge loss, which is a loss function used for classification problems in machine learning. ## Formula For a pair of actual and predicted values, represented as vectors `y_true` and `y_pred`, the Hinge loss is calculated as: - loss = `max(0, 1 - y_true * y_pred)`. It returns the average loss by dividing the `total_loss` by total no. of elemen

(y_true: &[f64], y_pred: &[f64])

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls 3

maxMethod · 0.80
iterMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected