edu.cmu.minorthird.classify.experiments
Class SubsamplingCrossValSplitter<T>

java.lang.Object
  extended by edu.cmu.minorthird.classify.experiments.SubsamplingCrossValSplitter<T>
All Implemented Interfaces:
Splitter<T>

public class SubsamplingCrossValSplitter<T>
extends java.lang.Object
implements Splitter<T>

Variant of cross-validation in which not all training data is used. Splits data into k separate disjoint folds, then return k train/test splits where each train set a sample of the union of k-1 folds, and the test set is the k-th fold. Preserves subpopulation information.

Author:
William Cohen

Constructor Summary
SubsamplingCrossValSplitter()
           
SubsamplingCrossValSplitter(int folds, double subsampleFraction)
           
SubsamplingCrossValSplitter(java.util.Random random, int folds, double subsampleFraction)
           
 
Method Summary
 int getNumberOfFolds()
           
 int getNumPartitions()
          Return the number of partitions produced by the last call to split()
 double getSubsampleFraction()
           
 java.util.Iterator<T> getTest(int k)
          Return an iterator over the test cases in the k-th split.
 java.util.Iterator<T> getTrain(int k)
          Return an iterator over the training cases in the k-th split.
 void setNumberOfFolds(int k)
           
 void setSubsampleFraction(double d)
           
 void split(java.util.Iterator<T> i)
          Split the iterator into a number of train/test partitions.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubsamplingCrossValSplitter

public SubsamplingCrossValSplitter(java.util.Random random,
                                   int folds,
                                   double subsampleFraction)

SubsamplingCrossValSplitter

public SubsamplingCrossValSplitter(int folds,
                                   double subsampleFraction)

SubsamplingCrossValSplitter

public SubsamplingCrossValSplitter()
Method Detail

getNumberOfFolds

public int getNumberOfFolds()

setNumberOfFolds

public void setNumberOfFolds(int k)

getSubsampleFraction

public double getSubsampleFraction()

setSubsampleFraction

public void setSubsampleFraction(double d)

split

public void split(java.util.Iterator<T> i)
Description copied from interface: Splitter
Split the iterator into a number of train/test partitions.

Specified by:
split in interface Splitter<T>

getNumPartitions

public int getNumPartitions()
Description copied from interface: Splitter
Return the number of partitions produced by the last call to split()

Specified by:
getNumPartitions in interface Splitter<T>

getTrain

public java.util.Iterator<T> getTrain(int k)
Description copied from interface: Splitter
Return an iterator over the training cases in the k-th split.

Specified by:
getTrain in interface Splitter<T>

getTest

public java.util.Iterator<T> getTest(int k)
Description copied from interface: Splitter
Return an iterator over the test cases in the k-th split.

Specified by:
getTest in interface Splitter<T>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object