Struct eval_metrics::classification::BinaryConfusionMatrix [−][src]
pub struct BinaryConfusionMatrix {
pub tp_count: usize,
pub fp_count: usize,
pub tn_count: usize,
pub fn_count: usize,
// some fields omitted
}Expand description
Confusion matrix for binary classification
Fields
tp_count: usizetrue positive count
fp_count: usizefalse positive count
tn_count: usizetrue negative count
fn_count: usizefalse negative count
Implementations
Computes a new binary confusion matrix from the provided scores and labels
Arguments
scores- vector of scoreslabels- vector of boolean labelsthreshold- decision threshold value for classifying scores
Errors
An invalid input error will be returned if either scores or labels are empty, or if their lengths do not match. An undefined metric error will be returned if scores contain any value that is not finite.
Examples
use eval_metrics::classification::BinaryConfusionMatrix;
let scores = vec![0.4, 0.7, 0.1, 0.3, 0.9];
let labels = vec![false, true, false, true, true];
let matrix = BinaryConfusionMatrix::compute(&scores, &labels, 0.5)?;pub fn with_counts(
tp_count: usize,
fp_count: usize,
tn_count: usize,
fn_count: usize
) -> Result<BinaryConfusionMatrix, EvalError>
pub fn with_counts(
tp_count: usize,
fp_count: usize,
tn_count: usize,
fn_count: usize
) -> Result<BinaryConfusionMatrix, EvalError>
Trait Implementations
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
Auto Trait Implementations
impl RefUnwindSafe for BinaryConfusionMatrix
impl Send for BinaryConfusionMatrix
impl Sync for BinaryConfusionMatrix
impl Unpin for BinaryConfusionMatrix
impl UnwindSafe for BinaryConfusionMatrix
Blanket Implementations
Mutably borrows from an owned value. Read more