edu.stanford.nlp.classify
Class CrossValidator<L,F>

java.lang.Object
  extended by edu.stanford.nlp.classify.CrossValidator<L,F>

public class CrossValidator<L,F>
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, Sarah Spikes (Templatization)

Nested Class Summary
static class CrossValidator.SavedState
           
 
Constructor Summary
CrossValidator(GeneralDataset<L,F> trainData)
           
CrossValidator(GeneralDataset<L,F> trainData, int kfold)
           
 
Method Summary
 double computeAverage(Function<Triple<GeneralDataset<L,F>,GeneralDataset<L,F>,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<L,F> trainData)

CrossValidator

public CrossValidator(GeneralDataset<L,F> trainData,
                      int kfold)
Method Detail

computeAverage

public double computeAverage(Function<Triple<GeneralDataset<L,F>,GeneralDataset<L,F>,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