java.lang.Object
de.uni_mannheim.informatik.dws.melt.matching_eval.evaluator.metric.cm.ConfusionMatrix
Direct Known Subclasses:
ConfusionMatrixMacroAveraged

public class ConfusionMatrix extends Object
Data Structure for an individual confusion matrix.
Author:
Sven Hertling, Jan Portisch
  • Field Details

    • truePositive

      protected Alignment truePositive
    • falsePositive

      protected Alignment falsePositive
    • falseNegative

      protected Alignment falseNegative
    • precision

      protected double precision
    • recall

      protected double recall
    • numberOfCorrespondences

      protected int numberOfCorrespondences
      The number of correspondences. Typically, this number is truePositive + falsePositive but this is not the case for partial gold standards!
  • Constructor Details

    • ConfusionMatrix

      public ConfusionMatrix(Alignment truePositive, Alignment falsePositive, Alignment falseNegative, double precision, double recall)
      Constructor to fill confusion matrix. The number of correspondences is assumed to be truePositive + falsePositive.
      Parameters:
      truePositive - True positive mapping.
      falsePositive - False positive mapping.
      falseNegative - False negative mapping
      precision - Precision as double [0, 1].
      recall - Recall as double [0, 1].
    • ConfusionMatrix

      public ConfusionMatrix(Alignment truePositive, Alignment falsePositive, Alignment falseNegative, int numberOfCorrespondences, double precision, double recall)
      Constructor to fill confusion matrix.
      Parameters:
      truePositive - True positive mapping.
      falsePositive - False positive mapping.
      falseNegative - False negative mapping
      numberOfCorrespondences - The number of correspondences. Note that this number can deviate from truePositive + falsePositive in case of partial gold standards.
      precision - Precision as double [0, 1].
      recall - Recall as double [0, 1].
  • Method Details

    • getTruePositive

      public Alignment getTruePositive()
      Alignments which are in the reference mapping and are also found by the matcher.
      Returns:
      found and correct mappings (correct)
    • getTruePositiveSize

      public int getTruePositiveSize()
    • getFalsePositive

      public Alignment getFalsePositive()
      Alignments which are not correct but found by the matcher
      Returns:
      found but not correct mappings (too much)
    • getFalsePositiveSize

      public int getFalsePositiveSize()
    • getFalseNegative

      public Alignment getFalseNegative()
      Alignments which are correct but not found by the matcher
      Returns:
      correct but not found by the matcher (should be found)
    • getFalseNegativeSize

      public int getFalseNegativeSize()
    • getPrecision

      public double getPrecision()
    • getRecall

      public double getRecall()
    • getF1measure

      public double getF1measure()
    • getFbetaMeasure

      public double getFbetaMeasure(double beta)
    • getNumberOfCorrespondences

      public int getNumberOfCorrespondences()
    • setNumberOfCorrespondences

      public void setNumberOfCorrespondences(int numberOfCorrespondences)
    • subtract

      public ConfusionMatrix subtract(ConfusionMatrix other)
      Returns a new confusion matrix where tp, fp, fn are subtracted from the other confusion matrix.
      Parameters:
      other - the other confusion matrix.
      Returns:
      a new confusion matrix which is the set difference.
    • toString

      public String toString()
      Overrides:
      toString in class Object