gov.sandia.cognition.learning.experiment
Class AbstractValidationFoldExperiment<InputDataType,FoldDataType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.experiment.AbstractLearningExperiment
          extended by gov.sandia.cognition.learning.experiment.AbstractValidationFoldExperiment<InputDataType,FoldDataType>
Type Parameters:
InputDataType - The type of data used in the experiment. It is what is passed to the fold creator to create folds from.
FoldDataType - The type of data in the folds of the experiment, as defined by the fold creator. It is typically the same as the InputDataType, but does not have to be.
All Implemented Interfaces:
LearningExperiment, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
LearnerComparisonExperiment, LearnerValidationExperiment

public abstract class AbstractValidationFoldExperiment<InputDataType,FoldDataType>
extends AbstractLearningExperiment

The AbstractValidationFoldExperiment class implements a common way of structuring an experiment around a ValidationFoldCreator object where the fold creator is used to create each of the individual trials of the experiment.

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

Field Summary
protected  ValidationFoldCreator<InputDataType,FoldDataType> foldCreator
          The method to use to create the validation folds.
protected  int numTrials
          The number of trials in the experiment, which is the number of folds in the experiment.
 
Fields inherited from class gov.sandia.cognition.learning.experiment.AbstractLearningExperiment
listeners
 
Constructor Summary
AbstractValidationFoldExperiment()
          Creates a new instance of AbstractValidationFoldExperiment.
AbstractValidationFoldExperiment(ValidationFoldCreator<InputDataType,FoldDataType> foldCreator)
          Creates a new instance of AbstractValidationFoldExperiment.
 
Method Summary
 ValidationFoldCreator<InputDataType,FoldDataType> getFoldCreator()
          Gets the fold creator.
 int getNumTrials()
          Gets the number of trials in the experiment.
protected  void runExperiment(Collection<PartitionedDataset<FoldDataType>> folds)
          Runs the underlying validation fold experiment using the given data.
protected abstract  void runTrial(PartitionedDataset<FoldDataType> fold)
          Runs a single trial of the experiment on one fold of the data.
 void setFoldCreator(ValidationFoldCreator<InputDataType,FoldDataType> foldCreator)
          Sets the fold creator.
protected  void setNumTrials(int numTrials)
          Sets the number of trials in the experiment.
 
Methods inherited from class gov.sandia.cognition.learning.experiment.AbstractLearningExperiment
addListener, fireExperimentEnded, fireExperimentStarted, fireTrialEnded, fireTrialStarted, getListeners, removeListener, setListeners
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

foldCreator

protected ValidationFoldCreator<InputDataType,FoldDataType> foldCreator
The method to use to create the validation folds.


numTrials

protected int numTrials
The number of trials in the experiment, which is the number of folds in the experiment.

Constructor Detail

AbstractValidationFoldExperiment

public AbstractValidationFoldExperiment()
Creates a new instance of AbstractValidationFoldExperiment.


AbstractValidationFoldExperiment

public AbstractValidationFoldExperiment(ValidationFoldCreator<InputDataType,FoldDataType> foldCreator)
Creates a new instance of AbstractValidationFoldExperiment.

Parameters:
foldCreator - The fold creator to use.
Method Detail

runExperiment

protected void runExperiment(Collection<PartitionedDataset<FoldDataType>> folds)
Runs the underlying validation fold experiment using the given data. It takes care of firing off the appropriate events for the learner.

Parameters:
folds - The fold to run the experiment on.

runTrial

protected abstract void runTrial(PartitionedDataset<FoldDataType> fold)
Runs a single trial of the experiment on one fold of the data.

Parameters:
fold - The fold to run the trial of the experiment on.

getFoldCreator

public ValidationFoldCreator<InputDataType,FoldDataType> getFoldCreator()
Gets the fold creator.

Returns:
The fold creator.

setFoldCreator

public void setFoldCreator(ValidationFoldCreator<InputDataType,FoldDataType> foldCreator)
Sets the fold creator.

Parameters:
foldCreator - The fold creator.

getNumTrials

public int getNumTrials()
Description copied from interface: LearningExperiment
Gets the number of trials in the experiment.

Returns:
The number of trials in the experiment.

setNumTrials

protected void setNumTrials(int numTrials)
Sets the number of trials in the experiment.

Parameters:
numTrials - The number of trials in the experiment.