org.debellor.base.evaluator
Class CrossValidation
java.lang.Object
org.debellor.core.Cell
org.debellor.base.evaluator.EvaluatorCell
org.debellor.base.evaluator.CrossValidation
public class CrossValidation
- extends EvaluatorCell
Implements evaluation of a cell (decision system) through the procedure of cross-validation (CV).
See EvaluatorCell
for more information about usage.
The evaluated cell must be erasable (it must correctly override Cell.onErase()
).
Parameters:
- folds: number of folds of CV. Default: 10.
- repetitions: number of times the entire procedure (cross-validation) will be repeated.
Repetitions are independent and data are split randomly in each of them.
Final results are summed over all repetitions
(the same Score instance is used for all of them).
Default: 1.
- fixTrain: number of first samples of data that will always go to the training set,
in every fold of CV. Only the remaining samples undergo splitting
and can be used as a test set. Default: 0.
- reversed: if
true
, the smaller part of each data split
becomes a training set (normally it is the larger part that is used for training).
Default: false
.
- score: name of the Score class to be used to measure quality of the evaluated decision system.
See docs for
EvaluatorCell
.
- Author:
- Marcin Wojnarski
Method Summary |
protected void |
onLearn()
Learning procedure of the cell. |
protected void |
releaseData()
|
Methods inherited from class org.debellor.core.Cell |
close, erase, getAvailableParams, getParameters, learn, newThread, newThread, next, onClose, onNext, onOpen, open, openInputStream, set, set, set, set, setAvailableParams, setParameters, setRandomSeed, setSource, state, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
input
protected Cell.Stream input
CrossValidation
public CrossValidation()
CrossValidation
public CrossValidation(Cell cell)
onLearn
protected void onLearn()
throws java.lang.Exception
- Description copied from class:
Cell
- Learning procedure of the cell.
For example, may train the internal decision model;
read and buffer input data; calculate an evaluation measure of another cell;
calculate data-driven parameters of a preprocessing algorithm
(e.g. attribute means for normalization algorithm) etc.
Called by
Cell.learn()
.
Must be overridden in all subclasses that implement trainable cells.
If your cell is not trainable, you must provide this information
to the Cell
base class by calling Cell.Cell(boolean)
instead of Cell.Cell()
in your constructor.
Overriders may safely assume that the cell is in Cell.State.EMPTY
state
when onLearn
is called - this is guaranteed by
implementation of learn()
.
- Overrides:
onLearn
in class Cell
- Throws:
java.lang.Exception
releaseData
protected void releaseData()
- Overrides:
releaseData
in class EvaluatorCell