gov.sandia.cognition.learning.experiment
Class ParallelLearnerValidationExperiment<InputDataType,FoldDataType,LearnedType,StatisticType,SummaryType>

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>
              extended by gov.sandia.cognition.learning.experiment.LearnerValidationExperiment<InputDataType,FoldDataType,LearnedType,StatisticType,SummaryType>
                  extended by gov.sandia.cognition.learning.experiment.ParallelLearnerValidationExperiment<InputDataType,FoldDataType,LearnedType,StatisticType,SummaryType>
Type Parameters:
InputDataType - The type of the data to perform the experiment with. This will be passed to the fold creator to create a number of folds on which to validate the performance of the learning algorithm.
FoldDataType - The type of data created by the fold creator that will go into the learning algorithm. Typically, this is the same as the InputDataType, but it does not need to be. It just needs to match the output of the fold creator and the input of the learning algorithm.
LearnedType - The type of the output produced by the learning algorithm whose performance will be evaluated on each fold of data.
StatisticType - The type of the statistic generated by the performance evaluator on the learned object for each fold. It is created by passing the learned object plus the test data for the fold into the performance evaluator.
SummaryType - The type produced by the summarizer at the end of the experiment from a collection of the given statistics (one for each fold). This represents the performance result for the learning algorithm for the whole experiment.
All Implemented Interfaces:
ParallelAlgorithm, LearningExperiment, PerformanceEvaluator<BatchLearner<? super Collection<? extends FoldDataType>,? extends LearnedType>,Collection<? extends InputDataType>,SummaryType>, CloneableSerializable, Serializable, Cloneable

public class ParallelLearnerValidationExperiment<InputDataType,FoldDataType,LearnedType,StatisticType,SummaryType>
extends LearnerValidationExperiment<InputDataType,FoldDataType,LearnedType,StatisticType,SummaryType>
implements ParallelAlgorithm

Parallel version of the LearnerValidationExperiment class that executes the validations experiments across available cores and hyperthreads.

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

Field Summary
 
Fields inherited from class gov.sandia.cognition.learning.experiment.LearnerValidationExperiment
performanceEvaluator, statistics, summarizer, summary
 
Fields inherited from class gov.sandia.cognition.learning.experiment.AbstractValidationFoldExperiment
foldCreator, numTrials
 
Fields inherited from class gov.sandia.cognition.learning.experiment.AbstractLearningExperiment
listeners
 
Constructor Summary
ParallelLearnerValidationExperiment()
          Default constructor
ParallelLearnerValidationExperiment(ValidationFoldCreator<InputDataType,FoldDataType> foldCreator, PerformanceEvaluator<? super LearnedType,Collection<? extends FoldDataType>,? extends StatisticType> performanceEvaluator, Summarizer<? super StatisticType,? extends SummaryType> summarizer)
          Creates a new instance of ParallelLearnerValidationExperiment.
 
Method Summary
 int getNumThreads()
          Gets the number of threads in the thread pool.
 ThreadPoolExecutor getThreadPool()
          Gets the thread pool for the algorithm to use.
protected  void runExperiment(Collection<PartitionedDataset<FoldDataType>> folds)
          Runs the underlying validation fold experiment using the given data.
 void setThreadPool(ThreadPoolExecutor threadPool)
          Sets the thread pool for the algorithm to use.
 
Methods inherited from class gov.sandia.cognition.learning.experiment.LearnerValidationExperiment
evaluate, evaluatePerformance, getLearner, getPerformanceEvaluator, getStatistics, getSummarizer, getSummary, runTrial, setLearner, setPerformanceEvaluator, setStatistics, setSummarizer, setSummary
 
Methods inherited from class gov.sandia.cognition.learning.experiment.AbstractValidationFoldExperiment
getFoldCreator, getNumTrials, setFoldCreator, setNumTrials
 
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
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Constructor Detail

ParallelLearnerValidationExperiment

public ParallelLearnerValidationExperiment()
Default constructor


ParallelLearnerValidationExperiment

public ParallelLearnerValidationExperiment(ValidationFoldCreator<InputDataType,FoldDataType> foldCreator,
                                           PerformanceEvaluator<? super LearnedType,Collection<? extends FoldDataType>,? extends StatisticType> performanceEvaluator,
                                           Summarizer<? super StatisticType,? extends SummaryType> summarizer)
Creates a new instance of ParallelLearnerValidationExperiment.

Parameters:
foldCreator - The object to use for creating the folds.
performanceEvaluator - The evaluator to use to compute the performance of the learned object on each fold.
summarizer - The summarizer for summarizing the result of the performance evaluator from all the folds.
Method Detail

runExperiment

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

Overrides:
runExperiment in class AbstractValidationFoldExperiment<InputDataType,FoldDataType>
Parameters:
folds - The fold to run the experiment on.

getThreadPool

public ThreadPoolExecutor getThreadPool()
Description copied from interface: ParallelAlgorithm
Gets the thread pool for the algorithm to use.

Specified by:
getThreadPool in interface ParallelAlgorithm
Returns:
Thread pool used for parallelization.

setThreadPool

public void setThreadPool(ThreadPoolExecutor threadPool)
Description copied from interface: ParallelAlgorithm
Sets the thread pool for the algorithm to use.

Specified by:
setThreadPool in interface ParallelAlgorithm
Parameters:
threadPool - Thread pool used for parallelization.

getNumThreads

public int getNumThreads()
Description copied from interface: ParallelAlgorithm
Gets the number of threads in the thread pool.

Specified by:
getNumThreads in interface ParallelAlgorithm
Returns:
Number of threads in the thread pool