Package de.jungblut.classification.eval
Class TestSetIterationCallback<T extends Classifier>
- java.lang.Object
-
- de.jungblut.classification.eval.TestSetIterationCallback<T>
-
- 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 Summary
Constructors Constructor Description TestSetIterationCallback(EvaluationSplit split, WeightMapper<T> mapper, java.util.Comparator<Evaluator.EvaluationResult> resultComparison)Creates a new test set iteration callback instance.TestSetIterationCallback(EvaluationSplit split, WeightMapper<T> mapper, java.util.Comparator<Evaluator.EvaluationResult> resultComparison, int evaluationInterval)Creates a new test set iteration callback instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Evaluator.EvaluationResultgetBestResult()de.jungblut.math.DoubleVectorgetBestWeights()voidonIterationFinished(int iteration, double cost, de.jungblut.math.DoubleVector currentWeights)This callback is called from aAbstractMinimizerwhen a iteration of a minimization objective is finished.
-
-
-
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 onmapper- 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 onmapper- 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:IterationCompletionListenerThis callback is called from aAbstractMinimizerwhen a iteration of a minimization objective is finished.- Specified by:
onIterationFinishedin interfaceIterationCompletionListener- Parameters:
iteration- the number of the current iteration.cost- the cost at the current iteration.currentWeights- the current optimal weights.
-
getBestResult
public Evaluator.EvaluationResult getBestResult()
-
getBestWeights
public de.jungblut.math.DoubleVector getBestWeights()
-
-