Class ConfusionMatrix
java.lang.Object
de.uni_mannheim.informatik.dws.melt.matching_eval.evaluator.metric.cm.ConfusionMatrix
- Direct Known Subclasses:
ConfusionMatrixMacroAveraged
Data Structure for an individual confusion matrix.
- Author:
- Sven Hertling, Jan Portisch
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConfusionMatrix
(Alignment truePositive, Alignment falsePositive, Alignment falseNegative, double precision, double recall) Constructor to fill confusion matrix.ConfusionMatrix
(Alignment truePositive, Alignment falsePositive, Alignment falseNegative, int numberOfCorrespondences, double precision, double recall) Constructor to fill confusion matrix. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Alignments which are correct but not found by the matcherint
Alignments which are not correct but found by the matcherint
double
getFbetaMeasure
(double beta) int
double
double
Alignments which are in the reference mapping and are also found by the matcher.int
void
setNumberOfCorrespondences
(int numberOfCorrespondences) subtract
(ConfusionMatrix other) Returns a new confusion matrix where tp, fp, fn are subtracted from the other confusion matrix.toString()
-
Field Details
-
truePositive
-
falsePositive
-
falseNegative
-
precision
protected double precision -
recall
protected double recall -
numberOfCorrespondences
protected int numberOfCorrespondencesThe number of correspondences. Typically, this number istruePositive + 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 betruePositive + falsePositive
.- Parameters:
truePositive
- True positive mapping.falsePositive
- False positive mapping.falseNegative
- False negative mappingprecision
- 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 mappingnumberOfCorrespondences
- The number of correspondences. Note that this number can deviate fromtruePositive + falsePositive
in case of partial gold standards.precision
- Precision as double [0, 1].recall
- Recall as double [0, 1].
-
-
Method Details
-
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
Alignments which are not correct but found by the matcher- Returns:
- found but not correct mappings (too much)
-
getFalsePositiveSize
public int getFalsePositiveSize() -
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
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
-