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

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

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

Split into one train, one test partition. Ignores subpopulation information.

Author:
William Cohen

Constructor Summary
SimpleRandomSplitter()
           
SimpleRandomSplitter(double trainFraction)
           
SimpleRandomSplitter(java.util.Random random, double trainFraction)
           
 
Method Summary
 int getNumPartitions()
          Return the number of partitions produced by the last call to split()
 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 split(java.util.Iterator<T> i)
          Split the iterator into a number of train/test partitions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleRandomSplitter

public SimpleRandomSplitter(java.util.Random random,
                            double trainFraction)

SimpleRandomSplitter

public SimpleRandomSplitter(double trainFraction)

SimpleRandomSplitter

public SimpleRandomSplitter()
Method Detail

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>