InputDataType
- The type of the data to perform the experiment with. It will be
passed to the 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.public class LearnerRepeatExperiment<InputDataType,LearnedType,StatisticType,SummaryType> extends AbstractLearningExperiment implements PerformanceEvaluator<BatchLearner<? super java.util.Collection<? extends InputDataType>,? extends LearnedType>,PartitionedDataset<? extends InputDataType>,SummaryType>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_NUM_TRIALS
The default number of trials is 10.
|
protected int |
numTrials
The number of trials to repeat the learning.
|
protected PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends InputDataType>,? extends StatisticType> |
performanceEvaluator
The evaluator to use to compute the performance of the learned object on
each fold.
|
protected java.util.ArrayList<StatisticType> |
statistics
The performance evaluations made during the experiment.
|
protected Summarizer<? super StatisticType,? extends SummaryType> |
summarizer
The summarizer for summarizing the result of the performance evaluator
from all the folds.
|
protected SummaryType |
summary
The summary of the performance evaluations made at the end of the
experiment.
|
listeners
Constructor and Description |
---|
LearnerRepeatExperiment()
Creates a new instance of LearnerRepeatExperiment.
|
LearnerRepeatExperiment(int numTrials,
PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends InputDataType>,? extends StatisticType> performanceEvaluator,
Summarizer<? super StatisticType,? extends SummaryType> summarizer)
Creates a new instance of LearnerRepeatExperiment.
|
Modifier and Type | Method and Description |
---|---|
SummaryType |
evaluatePerformance(BatchLearner<? super java.util.Collection<? extends InputDataType>,? extends LearnedType> learner,
PartitionedDataset<? extends InputDataType> data)
Performs the experiment.
|
BatchLearner<? super java.util.Collection<? extends InputDataType>,? extends LearnedType> |
getLearner()
Gets the learner the experiment is being run on.
|
int |
getNumTrials()
Gets the number of trials in the experiment.
|
PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends InputDataType>,? extends StatisticType> |
getPerformanceEvaluator()
Gets the performance evaluator to apply to each fold.
|
java.util.ArrayList<StatisticType> |
getStatistics()
Gets the performance evaluations for the trials of the experiment.
|
Summarizer<? super StatisticType,? extends SummaryType> |
getSummarizer()
Gets the summarizer of the performance evaluations.
|
SummaryType |
getSummary()
Gets the summary of the experiment.
|
protected void |
runExperiment(PartitionedDataset<? extends InputDataType> data)
Runs the experiment.
|
protected void |
runTrial(PartitionedDataset<? extends InputDataType> data)
Runs one trial in the experiment.
|
protected void |
setLearner(BatchLearner<? super java.util.Collection<? extends InputDataType>,? extends LearnedType> learner)
Sets the learner the experiment is being run on.
|
void |
setNumTrials(int numTrials)
Sets the number of trials for the experiment to repeatedly call the
learning algorithm.
|
void |
setPerformanceEvaluator(PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends InputDataType>,? extends StatisticType> performanceEvaluator)
Sets the performance evaluator to apply to each fold.
|
protected void |
setStatistics(java.util.ArrayList<StatisticType> statistics)
Sets the performance evaluations for the trials of the experiment.
|
void |
setSummarizer(Summarizer<? super StatisticType,? extends SummaryType> summarizer)
Sets the summarizer of the performance evaluations.
|
protected void |
setSummary(SummaryType summary)
Sets the summary of the experiment.
|
addListener, fireExperimentEnded, fireExperimentStarted, fireTrialEnded, fireTrialStarted, getListeners, removeListener, setListeners
clone
public static final int DEFAULT_NUM_TRIALS
protected int numTrials
protected PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends InputDataType>,? extends StatisticType> performanceEvaluator
protected Summarizer<? super StatisticType,? extends SummaryType> summarizer
protected java.util.ArrayList<StatisticType> statistics
protected SummaryType summary
public LearnerRepeatExperiment()
public LearnerRepeatExperiment(int numTrials, PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends InputDataType>,? extends StatisticType> performanceEvaluator, Summarizer<? super StatisticType,? extends SummaryType> summarizer)
numTrials
- The number of repeated trials to run.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.public SummaryType evaluatePerformance(BatchLearner<? super java.util.Collection<? extends InputDataType>,? extends LearnedType> learner, PartitionedDataset<? extends InputDataType> data)
evaluatePerformance
in interface PerformanceEvaluator<BatchLearner<? super java.util.Collection<? extends InputDataType>,? extends LearnedType>,PartitionedDataset<? extends InputDataType>,SummaryType>
data
- The data to use.learner
- The learner to perform the experiment on.protected void runExperiment(PartitionedDataset<? extends InputDataType> data)
data
- The data to use.protected void runTrial(PartitionedDataset<? extends InputDataType> data)
data
- The data to use.public PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends InputDataType>,? extends StatisticType> getPerformanceEvaluator()
public void setPerformanceEvaluator(PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends InputDataType>,? extends StatisticType> performanceEvaluator)
performanceEvaluator
- The performance evaluator to apply to each fold.public Summarizer<? super StatisticType,? extends SummaryType> getSummarizer()
public void setSummarizer(Summarizer<? super StatisticType,? extends SummaryType> summarizer)
summarizer
- The summarizer of the performance evaluations.public BatchLearner<? super java.util.Collection<? extends InputDataType>,? extends LearnedType> getLearner()
protected void setLearner(BatchLearner<? super java.util.Collection<? extends InputDataType>,? extends LearnedType> learner)
learner
- The learner.public java.util.ArrayList<StatisticType> getStatistics()
protected void setStatistics(java.util.ArrayList<StatisticType> statistics)
statistics
- The performance evaluations for the trials of the experiment.public SummaryType getSummary()
protected void setSummary(SummaryType summary)
summary
- The summary of the experiment.public int getNumTrials()
LearningExperiment
getNumTrials
in interface LearningExperiment
public void setNumTrials(int numTrials)
numTrials
- The number of trials. Must be positive.