ConfusionMatrix Class 
Namespace: Accord.Statistics.Analysis
The ConfusionMatrix type exposes the following members.
Name  Description  

ConfusionMatrix(Int32) 
Constructs a new Confusion Matrix.
 
ConfusionMatrix(Boolean, Boolean) 
Constructs a new Confusion Matrix.
 
ConfusionMatrix(Int32, Int32, Int32) 
Constructs a new Confusion Matrix.
 
ConfusionMatrix(Int32, Int32, Int32, Int32) 
Constructs a new Confusion Matrix.
 
ConfusionMatrix(Int32, Int32, Int32, Int32) 
Constructs a new Confusion Matrix.

Name  Description  

Accuracy 
Accuracy, or raw performance of the system
 
ActualNegatives 
Gets the number of actual negatives
 
ActualPositives 
Gets the number of actual positives.
 
ChiSquare 
Gets the ChiSquare statistic for the contingency table.
 
ColumnTotals 
Gets the marginal sums for table columns.
 
Efficiency 
Efficiency, the arithmetic mean of sensitivity and specificity
 
ExpectedValues 
Expected values, or values that could
have been generated just by chance.
 
FalseDiscoveryRate 
False Discovery Rate, or the expected false positive rate.
 
FalseNegatives 
Cases incorrectly identified by the system as negatives.
 
FalsePositiveRate 
False Positive Rate, also known as false alarm rate.
 
FalsePositives 
Cases incorrectly identified by the system as positives.
 
FScore  
Kappa 
Kappa coefficient.
 
Matrix 
Gets the confusion matrix in count matrix form.
 
MatthewsCorrelationCoefficient 
Matthews Correlation Coefficient, also known as Phi coefficient
 
NegativePredictiveValue 
Negative Predictive Value, also known as Negative Precision
 
NormalizedMutualInformation 
Normalized Mutual Information.
 
OddsRatio 
Oddsratio.
 
OverallDiagnosticPower 
Diagnostic power.
 
PositivePredictiveValue 
Positive Predictive Value, also known as Positive Precision
 
Precision 
Precision, same as the PositivePredictiveValue.
 
PredictedNegatives 
Gets the number of predicted negatives.
 
PredictedPositives 
Gets the number of predicted positives.
 
Prevalence 
Prevalence of outcome occurrence.
 
Recall 
Recall, same as the Sensitivity.
 
RowTotals 
Gets the marginal sums for table rows.
 
Samples 
Gets the number of observations for this matrix
 
Sensitivity 
Sensitivity, also known as True Positive Rate
 
Specificity 
Specificity, also known as True Negative Rate
 
StandardError 
Gets the standard error of the Kappa
coefficient of performance.
 
StandardErrorUnderNull 
Gets the standard error of the Kappa
under the null hypothesis that the underlying Kappa
value is 0.
 
TrueNegatives 
Cases correctly identified by the system as negatives.
 
TruePositives 
Cases correctly identified by the system as positives.
 
Variance 
Gets the variance of the Kappa
coefficient of performance.
 
VarianceUnderNull 
Gets the variance of the Kappa
under the null hypothesis that the underlying
Kappa value is 0.

Name  Description  

Combine 
Combines several confusion matrices into one single matrix.
 
Equals  Determines whether the specified object is equal to the current object. (Inherited from Object.)  
Finalize  Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)  
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
MemberwiseClone  Creates a shallow copy of the current Object. (Inherited from Object.)  
ToGeneralMatrix 
Converts this matrix into a GeneralConfusionMatrix.
 
ToString 
Returns a String representing this confusion matrix.
(Overrides ObjectToString.) 
Name  Description  

HasMethod 
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)  
ToT  Overloaded.
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.)  
ToT  Overloaded.
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 Matrix.) 
// 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.