emolib.util.eval
Class ConfusionMatrixCalculator

java.lang.Object
  extended by emolib.util.eval.ConfusionMatrixCalculator

public class ConfusionMatrixCalculator
extends java.lang.Object

The ConfusionMatrixCalculator class calculates the confusion matrix associated to two input datasets.

The two input datasets are entered as two command line parameters that name the two files that contain the datasets. The first one corresponds to the original categorised dataset while the second one corresponds to the prediction dataset. One third parameter is provided indicating the different labels (categories) that are to be found in the datasets. These categories have to be hyphen-separated. It is preferred to be done like this because in case that in the datasets one of the expected categories didn't appear, this would be rather confusing for the expert interpreting the results. Note that at least two categories must be provided.

The ConfusionMatrixCalculator class contains a main method to execute the class directly with the appropriate command line parameters. In case a quick reference of its usage is needed, the class responds to the typical help queries ("-h" or "--help") by showing the program's synopsis.

Author:
Alexandre Trilla (atrilla@salle.url.edu)

Constructor Summary
ConfusionMatrixCalculator()
          Void constructor.
 
Method Summary
 void evaluate(java.lang.String categoryOriginalFile, java.lang.String categoryPredictionFile)
          Method to evaluate the datasets and construct the confusion matrix.
 void initialize(java.lang.String inputCategories)
          Method to initialize the confusion matrix.
static void main(java.lang.String[] args)
          The main method of the ConfusionMatrixCalculator application.
 void printConfusionMatrix()
          Method to print the resulting confusion matrix.
 void printSynopsis()
          Prints the synopsis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfusionMatrixCalculator

public ConfusionMatrixCalculator()
Void constructor.

Method Detail

initialize

public void initialize(java.lang.String inputCategories)
Method to initialize the confusion matrix. This method requires a string with the different categories separated by a hyphen.

Parameters:
inputCategories - The categories.

evaluate

public void evaluate(java.lang.String categoryOriginalFile,
                     java.lang.String categoryPredictionFile)
Method to evaluate the datasets and construct the confusion matrix.

Parameters:
categoryOriginalFile - A category from the first file.
categoryPredictionFile - A category from the second file.

printConfusionMatrix

public void printConfusionMatrix()
Method to print the resulting confusion matrix.


printSynopsis

public void printSynopsis()
Prints the synopsis.


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
The main method of the ConfusionMatrixCalculator application.

Parameters:
args - The input arguments. The first one corresponds to the original categorized file, the second one corresponds to the prediction file and the third one corresponds to the categories the system is allowed to deal with.
Throws:
java.lang.Exception