Click or drag to resize
Accord.NET (logo)

ConfusionMatrix Class

Binary decision confusion matrix.
Inheritance Hierarchy
SystemObject
  Accord.Statistics.AnalysisConfusionMatrix
    Accord.Statistics.AnalysisReceiverOperatingCharacteristicPoint

Namespace:  Accord.Statistics.Analysis
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.6.0
Syntax
[SerializableAttribute]
public class ConfusionMatrix
Request Example View Source

The ConfusionMatrix type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyAccuracy
Accuracy, or raw performance of the system
Public propertyActualNegatives
Gets the number of actual negatives
Public propertyActualPositives
Gets the number of actual positives.
Public propertyChiSquare
Gets the Chi-Square statistic for the contingency table.
Public propertyColumnTotals
Gets the marginal sums for table columns.
Public propertyEfficiency
Efficiency, the arithmetic mean of sensitivity and specificity
Public propertyExpectedValues
Expected values, or values that could have been generated just by chance.
Public propertyFalseDiscoveryRate
False Discovery Rate, or the expected false positive rate.
Public propertyFalseNegatives
Cases incorrectly identified by the system as negatives.
Public propertyFalsePositiveRate
False Positive Rate, also known as false alarm rate.
Public propertyFalsePositives
Cases incorrectly identified by the system as positives.
Public propertyFScore
F-Score, computed as the harmonic mean of Precision and Recall.
Public propertyKappa
Kappa coefficient.
Public propertyMatrix
Gets the confusion matrix in count matrix form.
Public propertyMatthewsCorrelationCoefficient
Matthews Correlation Coefficient, also known as Phi coefficient
Public propertyNegativePredictiveValue
Negative Predictive Value, also known as Negative Precision
Public propertyNormalizedMutualInformation
Normalized Mutual Information.
Public propertyOddsRatio
Odds-ratio.
Public propertyOverallDiagnosticPower
Diagnostic power.
Public propertyPositivePredictiveValue
Positive Predictive Value, also known as Positive Precision
Public propertyPrecision
Precision, same as the PositivePredictiveValue.
Public propertyPredictedNegatives
Gets the number of predicted negatives.
Public propertyPredictedPositives
Gets the number of predicted positives.
Public propertyPrevalence
Prevalence of outcome occurrence.
Public propertyRecall
Recall, same as the Sensitivity.
Public propertyRowTotals
Gets the marginal sums for table rows.
Public propertySamples
Gets the number of observations for this matrix
Public propertySensitivity
Sensitivity, also known as True Positive Rate
Public propertySpecificity
Specificity, also known as True Negative Rate
Public propertyStandardError
Gets the standard error of the Kappa coefficient of performance.
Public propertyStandardErrorUnderNull
Gets the standard error of the Kappa under the null hypothesis that the underlying Kappa value is 0.
Public propertyTrueNegatives
Cases correctly identified by the system as negatives.
Public propertyTruePositives
Cases correctly identified by the system as positives.
Public propertyVariance
Gets the variance of the Kappa coefficient of performance.
Public propertyVarianceUnderNull
Gets the variance of the Kappa under the null hypothesis that the underlying Kappa value is 0.
Top
Methods
  NameDescription
Public methodStatic memberCombine
Combines several confusion matrices into one single matrix.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToGeneralMatrix
Converts this matrix into a GeneralConfusionMatrix.
Public methodToString
Returns a String representing this confusion matrix.
(Overrides ObjectToString.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodToT
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Examples
// The correct and expected output values (as confirmed by a Gold
//  standard rule, actual experiment or true verification)
int[] expected = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 };

// The values as predicted by the decision system or
//  the test whose performance is being measured.
int[] predicted = { 0, 0, 0, 1, 1, 0, 0, 0, 0, 1 };


// In this test, 1 means positive, 0 means negative
int positiveValue = 1;
int negativeValue = 0;

// Create a new confusion matrix using the given parameters
ConfusionMatrix matrix = new ConfusionMatrix(predicted, expected,
    positiveValue, negativeValue);

// At this point,
//   True Positives should be equal to 1;
//   True Negatives should be equal to 6;
//   False Negatives should be equal to 1;
//   False Positives should be equal to 2.
See Also