T
- The type of the training examplespublic class CrossValidationHelper<T> extends Object
Jan 30, 2009
Modifier and Type | Field and Description |
---|---|
protected int |
numFolds |
Constructor and Description |
---|
CrossValidationHelper(IExperimentFactory<T> experiment)
By default, do five fold cross validation
|
CrossValidationHelper(int numFolds,
IExperimentFactory<T> experiment) |
CrossValidationHelper(long timeoutSeconds,
int numThreads,
int numFolds,
IExperimentFactory<T> experimentFactory) |
Modifier and Type | Method and Description |
---|---|
double |
doCrossValidation(Iterable<T> data,
int dataSize)
NOTE: This does not take care of shuffling or randomizing the data.
|
OneVariableStats |
getStats() |
protected List<List<T>> |
splitData(Iterable<T> data,
int dataSize)
Splits the data into numFolds parts.
|
public CrossValidationHelper(IExperimentFactory<T> experiment)
experiment
- One run of the experiment ( test + train)public CrossValidationHelper(int numFolds, IExperimentFactory<T> experiment)
numFolds
- number of foldsexperiment
- one run of the experiment (test + train)public CrossValidationHelper(long timeoutSeconds, int numThreads, int numFolds, IExperimentFactory<T> experimentFactory)
public double doCrossValidation(Iterable<T> data, int dataSize) throws InterruptedException, ExecutionException
public OneVariableStats getStats()
protected List<List<T>> splitData(Iterable<T> data, int dataSize)
Note: This splits the data into K folds uniformly. If the classes are not equally distributed, then this is wrong. Instead, override this to do a stratified split, so that the split proportions are maintained.
Copyright © 2017. All rights reserved.