public class CrossValidation<T extends Output<T>,E extends Evaluation<T>> extends Object
This splits the data into k pieces, tests on one of them and trains on the rest.
It produces a list of Evaluation
s for each of the test sets.
Constructor and Description |
---|
CrossValidation(Trainer<T> trainer,
Dataset<T> data,
Evaluator<T,E> evaluator,
int k)
Builds a k-fold cross-validation loop.
|
CrossValidation(Trainer<T> trainer,
Dataset<T> data,
Evaluator<T,E> evaluator,
int k,
long seed)
Builds a k-fold cross-validation loop.
|
Modifier and Type | Method and Description |
---|---|
List<com.oracle.labs.mlrg.olcut.util.Pair<E,Model<T>>> |
evaluate()
Performs k fold cross validation, returning the k evaluations.
|
int |
getK()
Returns the number of folds.
|
public CrossValidation(Trainer<T> trainer, Dataset<T> data, Evaluator<T,E> evaluator, int k)
trainer
- the trainer to use.data
- the dataset to split.evaluator
- the evaluator to use.k
- the number of folds.public CrossValidation(Trainer<T> trainer, Dataset<T> data, Evaluator<T,E> evaluator, int k, long seed)
trainer
- the trainer to use.data
- the dataset to split.evaluator
- the evaluator to use.k
- the number of folds.seed
- The RNG seed.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.