cc.mallet.types
Class InstanceList.CrossValidationIterator
java.lang.Object
cc.mallet.types.InstanceList.CrossValidationIterator
- All Implemented Interfaces:
- java.io.Serializable, java.util.Iterator<InstanceList[]>
- Enclosing class:
- InstanceList
public class InstanceList.CrossValidationIterator
- extends java.lang.Object
- implements java.util.Iterator<InstanceList[]>, java.io.Serializable
CrossValidationIterator
allows iterating over pairs of
InstanceList
, where each pair is split into training/testing
based on nfolds.
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InstanceList.CrossValidationIterator
public InstanceList.CrossValidationIterator(int _nfolds,
int seed)
- Parameters:
_nfolds
- number of folds to split InstanceList intoseed
- seed for random number used to split InstanceList
InstanceList.CrossValidationIterator
public InstanceList.CrossValidationIterator(int _nfolds)
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface java.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)
and InstanceList[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 interface java.util.Iterator<InstanceList[]>
remove
public void remove()
- Specified by:
remove
in interface java.util.Iterator<InstanceList[]>