gov.sandia.cognition.learning.experiment
Class LeaveOneOutFoldCreator<DataType>

java.lang.Object
  extended by gov.sandia.cognition.learning.experiment.LeaveOneOutFoldCreator<DataType>
Type Parameters:
DataType - The type of data to create the folds for.
All Implemented Interfaces:
ValidationFoldCreator<DataType,DataType>, Serializable

public class LeaveOneOutFoldCreator<DataType>
extends Object
implements ValidationFoldCreator<DataType,DataType>, Serializable

The LeaveOneOutFoldCreator class implements the leave-one-out method for creating training-testing folds for a cross-validation experiment. The leave-one-out method takes a data set containing n items and creates n folds where each fold contains n - 1 training items and 1 testing item.

Since:
2.0
Author:
Justin Basilico
See Also:
Serialized Form

Constructor Summary
LeaveOneOutFoldCreator()
          Creates a new instance of LeaveOneOutCreator
 
Method Summary
 List<PartitionedDataset<DataType>> createFolds(Collection<? extends DataType> data)
          Creates a list of folds that is the same size as the given data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LeaveOneOutFoldCreator

public LeaveOneOutFoldCreator()
Creates a new instance of LeaveOneOutCreator

Method Detail

createFolds

public List<PartitionedDataset<DataType>> createFolds(Collection<? extends DataType> data)
Creates a list of folds that is the same size as the given data. Each fold contains n - 1 training examples and 1 testing example. Thus, there is one fold for each example, which is the one where it appears as a testing example.

Specified by:
createFolds in interface ValidationFoldCreator<DataType,DataType>
Parameters:
data - The data to create the folds for.
Returns:
The created validation folds.