Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Convert a confusion matrix into a ClassifierMeasurementsObject from which statistics can be derived
ResourceFunction["ConfusionMatrixToClassifierMeasurementsObject"][m,classes] converts a numeric confusion matrix m into a ClassifierMeasurementsObject where classes are a list of the classes. |
Create a ClassifierMeasurementsObject out of a confusion matrix where the classes are "healthy" and "sick":
| In[1]:= |
| Out[1]= | ![]() |
Show the properties of the object generated by the confusion matrix:
| In[2]:= |
| Out[2]= |
Show a confusion matrix in which the last column represents indeterminate cases and thus is dropped:
| In[3]:= |
| Out[3]= | ![]() |
A confusion matrix with five classes:
| In[4]:= | ![]() |
| Out[4]= | ![]() |
Numeric properties of a ClassifierMeasurementsObject are available:
| In[5]:= | ![]() |
| Out[5]= | ![]() |
Properties that produce plots are also available:
| In[6]:= | ![]() |
| Out[6]= | ![]() |
Obtain a variety of statistics on a sample confusion matrix found in the Wikipedia entry for that topic:

| In[7]:= |
| Out[7]= | ![]() |
| In[8]:= | ![]() |
| Out[8]= | ![]() |
Perform a Bayesian analysis with the data by computing the probability that a person who tests negative for cancer really does not have cancer:
| In[9]:= |
| Out[9]= |
Examine the accuracy and "ROCCurve" of a classifier in which one uses sex as a basis for determining if someone would survive the sinking of the Titanic:
| In[10]:= | ![]() |
| Out[10]= |
| In[11]:= |
| Out[11]= | ![]() |
Some properties of a ClassifierMeasurementsObject will be Missing:
| In[12]:= |
| Out[12]= | ![]() |
| In[13]:= |
| Out[13]= |
The "ClassMeanCrossEntropy" property will take on infinite values:
| In[14]:= |
| Out[14]= |
Properties that yield show examples will not be well defined:
| In[15]:= |
| Out[15]= |
If a row of the confusion matrix sums to zero, i. e. there are no examples of a certain class, an error message will be generated:
| In[16]:= |
| Out[16]= |
The function will work, however, if it has positive row sums but a column sum of the matrix is zero:
| In[17]:= |
| Out[17]= | ![]() |
Create a composite confusion matrix from data that has been analyzed using cross-validation and determine the performance of the "NaiveBayes" classifier:
| In[18]:= | ![]() |
| Out[18]= | ![]() |
Show a representative output from the CrossValidateModel resource function:
| In[19]:= | ![]() |
| Out[20]= | ![]() |
Create a composite confusion matrix:
| In[21]:= |
| Out[21]= |
Create the ClassifierMeasurementsObject:
| In[22]:= |
| In[23]:= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License