edu.umass.cs.mallet.base.types
Class InstanceList.CrossValidationIterator

java.lang.Object
  extended byedu.umass.cs.mallet.base.types.InstanceList.CrossValidationIterator
All Implemented Interfaces:
java.util.Iterator, java.io.Serializable
Enclosing class:
InstanceList

public class InstanceList.CrossValidationIterator
extends java.lang.Object
implements java.util.Iterator, 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

Constructor Summary
InstanceList.CrossValidationIterator(int _nfolds)
           
InstanceList.CrossValidationIterator(int _nfolds, int seed)
           
 
Method Summary
 boolean hasNext()
           
 java.lang.Object 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceList.CrossValidationIterator

public InstanceList.CrossValidationIterator(int _nfolds,
                                            int seed)
Parameters:
_nfolds - number of folds to split InstanceList into
seed - seed for random number used to split InstanceList

InstanceList.CrossValidationIterator

public InstanceList.CrossValidationIterator(int _nfolds)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

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 java.lang.Object next()
Specified by:
next in interface java.util.Iterator

remove

public void remove()
Specified by:
remove in interface java.util.Iterator