m_auc

Function m_auc 

Source
pub fn m_auc<T: Scalar>(
    scores: &Vec<Vec<T>>,
    labels: &Vec<usize>,
) -> Result<T, EvalError>
Expand description

Computes multi-class AUC as described by Hand and Till in “A Simple Generalisation of the Area Under the ROC Curve for Multiple Class Classification Problems” (2001)

§Arguments

  • scores - vector of class scores
  • labels - vector of class labels

§Errors

An invalid input error will be returned if either scores or labels are empty or contain a single data point, or if their lengths do not match. An undefined metric error will be returned if scores contain any value that is not finite, or if any pairwise roc curve is not defined for all distinct class label pairs.

§Examples

use eval_metrics::classification::m_auc;
let scores = vec![
   vec![0.3, 0.1, 0.6],
   vec![0.5, 0.2, 0.3],
   vec![0.2, 0.7, 0.1],
   vec![0.3, 0.3, 0.4],
   vec![0.5, 0.1, 0.4],
   vec![0.8, 0.1, 0.1],
   vec![0.3, 0.5, 0.2]
];
let labels = vec![2, 1, 1, 2, 0, 2, 0];
let metric = m_auc(&scores, &labels)?;