Skip to main content

softmax_normalize

Function softmax_normalize 

Source
pub fn softmax_normalize(scores: &[(VectorId, f32)]) -> Vec<(VectorId, f32)>
Expand description

Softmax normalize scores.

Uses the max-subtraction trick for numerical stability.

  • Empty input → empty output.
  • Zero sum (should not occur in practice) → uniform 1/n.