edu.stanford.nlp.classify
Class CrossValidator<L,F>
java.lang.Object
edu.stanford.nlp.classify.CrossValidator<L,F>
public class CrossValidator<L,F>
- extends java.lang.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)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CrossValidator
public CrossValidator(GeneralDataset<L,F> trainData)
CrossValidator
public CrossValidator(GeneralDataset<L,F> trainData,
int kfold)
computeAverage
public double computeAverage(Function<Triple<GeneralDataset<L,F>,GeneralDataset<L,F>,CrossValidator.SavedState>,java.lang.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(java.lang.String[] args)
Stanford NLP Group