rustlearn icon indicating copy to clipboard operation
rustlearn copied to clipboard

Normalized cumulative gain computation possibly incorrect

Open marcusklaas opened this issue 5 years ago • 0 comments

I was looking at the implementation here, copied below:

/// Normalized Discounted Cumulative Gain
///
/// # Panics
/// Will panic if inputs are of unequal length.
pub fn ndcg_score(y_true: &Array, y_hat: &Array, k: i32) -> f32 {
    assert!(y_true.rows() == y_hat.rows());
    let best = dcg_score(y_true, y_hat, k);
    let actual = dcg_score(y_true, y_hat, k);
    actual / best
}

Doesn't that always return 1.0f32 (unless it panics)? I would expect best to be computed as dcg_score(y_true, y_true, k).

marcusklaas avatar Mar 10 '21 14:03 marcusklaas