edu.cmu.minorthird.classify.experiments
Class StratifiedCrossValSplitter

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

public class StratifiedCrossValSplitter
extends java.lang.Object
implements Splitter<Example>

Works with datasets of binary examples. Splits POS and NEG examples into k separate disjoints folds, separately, and then returns k train/test splits where each train set is the union of k-1 folds, and the test set is the k-th fold. Does NOT preserve subpopulation information.

Author:
Edoardo Airoldi Date: Dec 8, 2003

Constructor Summary
StratifiedCrossValSplitter()
           
StratifiedCrossValSplitter(int folds)
           
StratifiedCrossValSplitter(java.util.Random random, int folds)
           
 
Method Summary
 int getNumPartitions()
          Return the number of partitions produced by the last call to split()
 java.util.Iterator<Example> getTest(int k)
          Return an iterator over the test cases in the k-th split.
 java.util.Iterator<Example> getTrain(int k)
          Return an iterator over the training cases in the k-th split.
 void split(java.util.Iterator<Example> 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

StratifiedCrossValSplitter

public StratifiedCrossValSplitter(java.util.Random random,
                                  int folds)

StratifiedCrossValSplitter

public StratifiedCrossValSplitter(int folds)

StratifiedCrossValSplitter

public StratifiedCrossValSplitter()
Method Detail

split

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

Specified by:
split in interface Splitter<Example>

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<Example>

getTrain

public java.util.Iterator<Example> 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<Example>

getTest

public java.util.Iterator<Example> 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<Example>

toString

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