Package cc.mallet.types
Class InstanceList.CrossValidationIterator
- java.lang.Object
-
- cc.mallet.types.InstanceList.CrossValidationIterator
-
- All Implemented Interfaces:
java.io.Serializable
,java.util.Iterator<InstanceList[]>
- Direct Known Subclasses:
InstanceList.StratifiedCrossValidationIterator
- Enclosing class:
- InstanceList
public class InstanceList.CrossValidationIterator extends java.lang.Object implements java.util.Iterator<InstanceList[]>, java.io.Serializable
CrossValidationIterator
allows iterating over pairs ofInstanceList
, where each pair is split into training/testing based on nfolds.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CrossValidationIterator(int _nfolds)
CrossValidationIterator(int _nfolds, int seed)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
InstanceList[]
next()
InstanceList[]
nextSplit()
Returns the next training/testing split.InstanceList[]
nextSplit(int numTrainFolds)
Returns the next split, given the number of folds you want in the training data.void
remove()
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<InstanceList[]>
-
nextSplit
public InstanceList[] nextSplit()
Returns the next training/testing split.- Returns:
- A pair of lists, where
InstanceList[0]
is the larger split (training) andInstanceList[1]
is the smaller split (testing)
-
nextSplit
public InstanceList[] nextSplit(int numTrainFolds)
Returns the next split, given the number of folds you want in the training data.
-
next
public InstanceList[] next()
- Specified by:
next
in interfacejava.util.Iterator<InstanceList[]>
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<InstanceList[]>
-
-