File confusion_matrix.hpp

struct ConfusionMatrix
#include <confusion_matrix.hpp>

A confusion matrix.

Public Functions

inline ConfusionMatrix()
inline ConfusionMatrix &operator=(const float64 &rhs)

Assigns a specific value to the elements of this confusion matrix.

Parameters:

rhs – A reference to the value to be assigned

Returns:

A reference to the modified confusion matrix

inline ConfusionMatrix &operator+=(const float64 &rhs)

Adds a specific value to the elements of this confusion matrix.

Parameters:

rhs – A reference to the value to be added

Returns:

A reference to the modified confusion matrix

inline ConfusionMatrix &operator+=(const ConfusionMatrix &rhs)

Adds the elements of a given confusion matrix to the elements of this confusion matrix.

Parameters:

rhs – A reference to the confusion matrix, whose elements should be added

Returns:

A reference to the modified confusion matrix

inline ConfusionMatrix &operator-=(const float64 &rhs)

Subtracts a specific value from the elements of this confusion matrix.

Parameters:

rhs – A reference to the value to be subtracted

Returns:

A reference to the modified confusion matrix

inline ConfusionMatrix &operator-=(const ConfusionMatrix &rhs)

Subtracts the elements of a given confusion matrix from the elements of this confusion matrix.

Parameters:

rhs – A reference to the confusion matrix, whose elements should be subtracted

Returns:

A reference to the modified confusion matrix

inline ConfusionMatrix &operator*=(const float64 &rhs)

Multiplies the elements of this confusion matrix with a specific value.

Parameters:

rhs – A reference to the value to be multiplied by

Returns:

A reference to the modified confusion matrix

inline float64 &getElement(bool trueLabel, bool majorityLabel)

Returns a reference to a confusion matrix element, given the ground truth and a prediction.

Parameters:
  • trueLabel – The true label according to the ground truth

  • majorityLabel – The prediction of the default rule. The prediction is assumed to be the inverse

Returns:

A reference to a confusion matrix element

Public Members

float64 in

Irrelevant labels for which a rule predicts negatively.

float64 ip

Irrelevant labels for which a rule predicts positively.

float64 rn

Relevant labels for which a rule predicts negatively.

float64 rp

Relevant labels for which a rule predicts positively.

Friends

inline friend ConfusionMatrix operator+(ConfusionMatrix lhs, const float64 &rhs)

Creates and returns a new confusion matrix that results from adding a specific value to the elements of an existing confusion matrix.

Parameters:
  • lhs – The original confusion matrix

  • rhs – A reference to the value to be added

Returns:

The confusion matrix that has been created

inline friend ConfusionMatrix operator+(ConfusionMatrix lhs, const ConfusionMatrix &rhs)

Creates and returns a new confusion matrix that results from adding the elements of a specific confusion matrix to the elements of an existing confusion matrix.

Parameters:
  • lhs – The original confusion matrix

  • rhs – A reference to the confusion matrix, whose elements should be added

Returns:

The confusion matrix that has been created

inline friend ConfusionMatrix operator-(ConfusionMatrix lhs, const float64 &rhs)

Creates and returns a new confusion matrix that results from subtracting a specific value from the elements of an existing confusion matrix.

Parameters:
  • lhs – The original confusion matrix

  • rhs – A reference to the value to be subtracted

Returns:

The confusion matrix that has been created

inline friend ConfusionMatrix operator-(ConfusionMatrix lhs, const ConfusionMatrix &rhs)

Creates and returns a new confusion matrix that results from subtracting the elements of a specific confusion matrix from the elements of an existing confusion matrix.

Parameters:
  • lhs – The original confusion matrix

  • rhs – A reference to the value to be subtracted

Returns:

The confusion matrix that has been created

inline friend ConfusionMatrix operator*(ConfusionMatrix lhs, const float64 &rhs)

Creates and returns a new confusion matrix that results from multiplying the elements of an existing confusion matrix with a specific value.

Parameters:
  • lhs – The original confusion matrix

  • rhs – A reference to the value to be multiplied by

Returns:

The confusion matrix that has been created