Skip to main content

sparsemap_loss_explicit

Function sparsemap_loss_explicit 

Source
pub fn sparsemap_loss_explicit(
    theta: &[f64],
    target: &[f64],
    vertices: &[Vec<f64>],
) -> Result<f64>
Expand description

Compute the SparseMAP Fenchel-Young loss for an explicit-domain target.

This computes:

L(theta; y) = Omega*(theta) - <theta, y> + 0.5 ||y||^2

where Omega* is supplied by sparsemap_explicit.

target is expected to be a marginal vector for the same explicit domain. This function validates shape and finiteness, but does not project or otherwise repair targets outside the convex hull.