package ie.dcu.eval; import ie.dcu.matrix.ByteMatrix; /** * Extracts the most useful measures from the other two evaluators * * @author Kevin McGuinness */ public class BestEvaluator extends AbstractEvaluator { /** * Object Jaccard index. */ public static final String OBJECT_ACCURACY = "Object"; /** * Fuzzy boundary accuracy measure. */ public static final String BOUNDARY_ACCURACY = "Boundary"; /** * Measures computed by the confusion matrix evaluator */ private final ConfusionMatrixEvaluator cmEvaluator; /** * Measures computed by the boundary accuracy evaluator */ private final BoundaryAccuracyEvaluator baEvaluator; /** * Constructor. */ public BestEvaluator() { // Create evaluators cmEvaluator = new ConfusionMatrixEvaluator(); baEvaluator = new BoundaryAccuracyEvaluator(); // Setup evaluator name = "Boundary and Object Accuracy Evaluator"; description = "Computes object jaccard index and fuzzy boundary index"; vendor = "Kevin McGuinness"; // Add measures addMeasure(OBJECT_ACCURACY); addMeasure(BOUNDARY_ACCURACY); } /** * Set the sigma parameter. * * The sigma parameter controls the tolerance of the fuzzy Jaccard * measure. * * @param sigma A value greater than zero. */ public void setSigma(double sigma) { baEvaluator.setSigma(sigma); } /** * Get the sigma parameter. */ public double getSigma() { return baEvaluator.getSigma(); } /** * Run the evaluator. */ public void run(ByteMatrix mask, ByteMatrix gt) throws IllegalArgumentException { cmEvaluator.run(mask, gt); baEvaluator.run(mask, gt); setResult(OBJECT_ACCURACY, cmEvaluator.getMeasure( ConfusionMatrixEvaluator.JACCARD)); setResult(BOUNDARY_ACCURACY, baEvaluator.getMeasure( BoundaryAccuracyEvaluator.FUZZY_ACCURACY)); } }