Struct Confusionmatrix

Source
pub struct Confusionmatrix {
    pub true_positive: i32,
    pub true_negative: i32,
    pub false_positive: i32,
    pub false_negative: i32,
}
Expand description

Defining a struct to represent a confusion matrix for a classifier

§Variable - details

Below are the variables used in the user defined rust structure Confusionmatrix.

  • true_positive - i32 - This denotes the number of true positives.
  • true_negative - i32 - This denotes the number of true negatives.
  • false_positive - i32 - This denotes the number of false positives.
  • false_negative - i32 - This denotes the number of false negatives.

Fields§

§true_positive: i32§true_negative: i32§false_positive: i32§false_negative: i32

Implementations§

Source§

impl Confusionmatrix

§Functionalities of the confusion matrix
§Methods - details

Below are the functions that are defined as methods for the Confusionmatrix structure.

  • total(&self) -> i32 : returns the total number of cases as an i32.
  • accuracy(&self) -> f32 : returns accuracy of the classifier as an f32.
  • precision(&self) -> f32 : returns precision of the classifier as an f32.
  • true_poitive_rate(&self) -> f32 : returns true positive rate of the classifier as an f32.
  • false_positive_rate(&self) -> f32 : returns false positive rate of the classifier as an f32.
  • misclassification_rate(&self) -> f32 : returns misclassification rate of the classifier as an f32.
  • specificity(&self) -> f32 : returns specificity of the classifier as an f32.
  • prevalance(&self) -> f32 : returns prevalance of the classifier as an f32.
Source

pub fn total(&self) -> i32

To find total number of predictions

Source

pub fn accuracy(&self) -> f32

To find the accuracy of the model

Source

pub fn precision(&self) -> f32

To find the precision of the model

Source

pub fn true_poitive_rate(&self) -> f32

To find the true positive rate of the model

Source

pub fn false_positive_rate(&self) -> f32

To find the false positive rate of the model

Source

pub fn misclassification_rate(&self) -> f32

To find the misclassification rate of the model

Source

pub fn specificity(&self) -> f32

To find the specificity of the model

Source

pub fn prevalance(&self) -> f32

To find the prevalance of the model

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.