edu.stanford.nlp.classify
Class CrossValidator

java.lang.Object
  extended by edu.stanford.nlp.classify.CrossValidator

public class CrossValidator
extends Object

This class is meant to simplify performing cross validation on classifiers for hyper-parameters. It has the ability to save state for each fold (for instance, the weights for a MaxEnt classifier, and the alphas for an SVM).

Author:
Aria Haghighi, Jenny Finkel

Nested Class Summary
static class CrossValidator.SavedState
           
 
Constructor Summary
CrossValidator(GeneralDataset trainData)
           
CrossValidator(GeneralDataset trainData, int kfold)
           
 
Method Summary
 double computeAverage(Function<Triple<GeneralDataset,GeneralDataset,CrossValidator.SavedState>,Double> function)
          This computes the average over all folds of the function we're trying to optimize.
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrossValidator

public CrossValidator(GeneralDataset trainData)

CrossValidator

public CrossValidator(GeneralDataset trainData,
                      int kfold)
Method Detail

computeAverage

public double computeAverage(Function<Triple<GeneralDataset,GeneralDataset,CrossValidator.SavedState>,Double> function)
This computes the average over all folds of the function we're trying to optimize. The input triple contains, in order, the train set, the test set, and the saved state. You don't have to use the saved state if you don't want to.


main

public static void main(String[] args)


Stanford NLP Group