Class InstanceList.CrossValidationIterator

  • All Implemented Interfaces:, java.util.Iterator<InstanceList[]>
    Direct Known Subclasses:
    Enclosing class:

    public class InstanceList.CrossValidationIterator
    extends java.lang.Object
    implements java.util.Iterator<InstanceList[]>,
    CrossValidationIterator allows iterating over pairs of InstanceList, where each pair is split into training/testing based on nfolds.
    See Also:
    Serialized Form
    • Constructor Detail

      • CrossValidationIterator

        public CrossValidationIterator​(int _nfolds,
                                       int seed)
        _nfolds - number of folds to split InstanceList into
        seed - seed for random number used to split InstanceList
      • CrossValidationIterator

        public CrossValidationIterator​(int _nfolds)
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<InstanceList[]>
      • nextSplit

        public InstanceList[] nextSplit()
        Returns the next training/testing split.
        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.
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<InstanceList[]>