pub fn top_k_accuracy(
scores: &[f32],
num_classes: usize,
targets: &[usize],
k: usize,
) -> Result<f32, EvalError>Expand description
Top-k accuracy: fraction of samples where the correct label is in the top-k predictions.
scores: [N, C] matrix (N samples, C classes) — raw scores or probabilities.
targets: [N] — true class indices.