Class TestSetIterationCallback<T extends Classifier>

  • All Implemented Interfaces:
    IterationCompletionListener

    public class TestSetIterationCallback<T extends Classifier>
    extends java.lang.Object
    implements IterationCompletionListener
    This callback is used to evaluate the performance on a held-out test set. It saves the best performing parameter inside to be retrieved later.
    Author:
    thomas.jungblut
    • Constructor Detail

      • TestSetIterationCallback

        public TestSetIterationCallback​(EvaluationSplit split,
                                        WeightMapper<T> mapper,
                                        java.util.Comparator<Evaluator.EvaluationResult> resultComparison,
                                        int evaluationInterval)
        Creates a new test set iteration callback instance.
        Parameters:
        split - the split to test on
        mapper - the weight mapper to transform a weight to a classifier.
        resultComparison - the comparator to compare what result is better and should be kept.
        evaluationInterval - how often the result should be evaluated.
      • TestSetIterationCallback

        public TestSetIterationCallback​(EvaluationSplit split,
                                        WeightMapper<T> mapper,
                                        java.util.Comparator<Evaluator.EvaluationResult> resultComparison)
        Creates a new test set iteration callback instance. The callback executes every 10 iterations.
        Parameters:
        split - the split to test on
        mapper - the weight mapper to transform a weight to a classifier.
        resultComparison - the comparator to compare what result is better and should be kept.
    • Method Detail

      • onIterationFinished

        public void onIterationFinished​(int iteration,
                                        double cost,
                                        de.jungblut.math.DoubleVector currentWeights)
        Description copied from interface: IterationCompletionListener
        This callback is called from a AbstractMinimizer when a iteration of a minimization objective is finished.
        Specified by:
        onIterationFinished in interface IterationCompletionListener
        Parameters:
        iteration - the number of the current iteration.
        cost - the cost at the current iteration.
        currentWeights - the current optimal weights.
      • getBestWeights

        public de.jungblut.math.DoubleVector getBestWeights()