com.sun.labs.minion.classification
Class RandomTwoThirdsSplitter

java.lang.Object
  extended by com.sun.labs.minion.classification.RandomTwoThirdsSplitter
All Implemented Interfaces:
ResultSplitter

public class RandomTwoThirdsSplitter
extends java.lang.Object
implements ResultSplitter

Provides two thirds/one third splits of a result set by selecting documents at random to place in either set.


Nested Class Summary
 class RandomTwoThirdsSplitter.Doc
           
 
Field Summary
protected  RandomTwoThirdsSplitter.Doc[] allDocs
           
protected  int numArrayGroups
          The number of array groups in the result set
protected  int numSplits
          The number of times to split
protected  ResultSetImpl parent
          The full results, as passed in
protected  ResultSetImpl train
          The set that should be trained on
protected  ResultSetImpl validate
          The set that should be used for validation
 
Constructor Summary
RandomTwoThirdsSplitter()
          Default constructor.
 
Method Summary
 int getMinDocs()
          Gets the minimum number of docs needed for this splitter to be useful.
 ResultSetImpl getTrainSet()
          Gets the first of the two subset
 ResultSetImpl getValidateSet()
          Gets the second of the two subsets
 void init(ResultSetImpl parent, IndexConfig iC)
          Initializes the class.
 boolean nextSplit()
          Advances to the next split, if there is one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numSplits

protected int numSplits
The number of times to split


train

protected ResultSetImpl train
The set that should be trained on


validate

protected ResultSetImpl validate
The set that should be used for validation


parent

protected ResultSetImpl parent
The full results, as passed in


numArrayGroups

protected int numArrayGroups
The number of array groups in the result set


allDocs

protected RandomTwoThirdsSplitter.Doc[] allDocs
Constructor Detail

RandomTwoThirdsSplitter

public RandomTwoThirdsSplitter()
Default constructor. Setup is performed in the init method.

Method Detail

init

public void init(ResultSetImpl parent,
                 IndexConfig iC)
Description copied from interface: ResultSplitter
Initializes the class. Since implementors of ResultSplitter will be created via reflection, the default constructor is used. After instantiation, this init method is called.

Specified by:
init in interface ResultSplitter
Parameters:
parent - the result set to split up
iC - the index config, possibly containing relevent settings for this splitter

getMinDocs

public int getMinDocs()
Gets the minimum number of docs needed for this splitter to be useful.

Specified by:
getMinDocs in interface ResultSplitter
Returns:
the number 3

getTrainSet

public ResultSetImpl getTrainSet()
Gets the first of the two subset

Specified by:
getTrainSet in interface ResultSplitter
Returns:
a result set that is a subset of the one passed in

getValidateSet

public ResultSetImpl getValidateSet()
Gets the second of the two subsets

Specified by:
getValidateSet in interface ResultSplitter
Returns:
a result set that is a subset of the one passed in

nextSplit

public boolean nextSplit()
Advances to the next split, if there is one. getFirstSet() and getSecondSet() will return the new splits after this method is called

Specified by:
nextSplit in interface ResultSplitter
Returns:
true if there is another split available