public class NFoldCrossValidation<T> extends java.lang.Object implements CrossValidation
Class for performing N-Fold Cross-validation.
The list of samples used is taken in order. Let us consider 10 folds. For the first fold, the first 10% are used for testing, and the remaining 90% are used for training. For the second fold, the second 10% are used for testing, and the remaining for training, and so on. Warning, no randomization is performed on the list, so be careful it is not in the order of the classes which would bias the learning.
| Constructor and Description |
|---|
NFoldCrossValidation(int n,
Classifier<T> cls,
java.util.List<TrainingSample<T>> l,
Evaluator<T> eval)
Default constructor with number of folds, classifier, full samples list and evaluation metric.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getAverageScore()
Tells the average score of the test
|
double[] |
getScores()
Tells the scores of the tests, in order of evaluation
|
double |
getStdDevScore()
Tells the standard deviation of the test
|
void |
run()
perform learning and evaluations
|
public NFoldCrossValidation(int n,
Classifier<T> cls,
java.util.List<TrainingSample<T>> l,
Evaluator<T> eval)
n - the number of foldscls - the classifier to evaluatel - the full list of sampleeval - the evaluation metric to compute on each foldpublic void run()
CrossValidationrun in interface CrossValidationpublic double getAverageScore()
CrossValidationgetAverageScore in interface CrossValidationpublic double getStdDevScore()
CrossValidationgetStdDevScore in interface CrossValidationpublic double[] getScores()
CrossValidationgetScores in interface CrossValidation