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 algorithms.FoldDataType
- The type of data created by the fold creator that will go into
the learning algorithms. 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
algorithms.LearnedType
- The type of the output produced by the learning
algorithms whose performance will be evaluated on each fold of data.StatisticType
- The type of the statistic generated by the
performance evaluator on each learned objects 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
comparison of the performance of the learning algorithms for the
whole experiment.public class LearnerComparisonExperiment<InputDataType,FoldDataType,LearnedType,StatisticType,SummaryType> extends AbstractValidationFoldExperiment<InputDataType,FoldDataType> implements java.io.Serializable
LearnerComparisonExperiment
compares the performance of two
machine learning algorithms to determine (using a statistical test) if the
two algorithms have significantly different performance.Modifier and Type | Class and Description |
---|---|
static class |
LearnerComparisonExperiment.Result<SummaryType>
Encapsulates the results of the comparison experiment.
|
Modifier and Type | Field and Description |
---|---|
protected ConfidenceStatistic |
confidence
The confidence statistic generated from the underlying performance
statistics.
|
protected Pair<BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>,BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>> |
learners
The learners that the experiment is being performed on.
|
protected PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends FoldDataType>,? extends StatisticType> |
performanceEvaluator
The evaluator to use to compute the performance of the learned object on
each fold.
|
protected DefaultPair<java.util.ArrayList<StatisticType>,java.util.ArrayList<StatisticType>> |
statistics
The performance evaluations made during the experiment.
|
protected DefaultPair<SummaryType,SummaryType> |
summaries
The summaries of performance.
|
protected Summarizer<? super StatisticType,? extends SummaryType> |
summarizer
The summarizer for summarizing the result of the performance evaluator
from all the folds.
|
foldCreator, numTrials
listeners
Constructor and Description |
---|
LearnerComparisonExperiment()
Creates a new instance of LearnerComparisonExperiment.
|
LearnerComparisonExperiment(ValidationFoldCreator<InputDataType,FoldDataType> foldCreator,
PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends FoldDataType>,? extends StatisticType> performanceEvaluator,
NullHypothesisEvaluator<java.util.Collection<? extends StatisticType>> statisticalTest,
Summarizer<? super StatisticType,? extends SummaryType> summarizer)
Creates a new instance of LearnerComparisonExperiment.
|
Modifier and Type | Method and Description |
---|---|
LearnerComparisonExperiment.Result<SummaryType> |
evaluate(BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType> learner1,
BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType> learner2,
java.util.Collection<? extends InputDataType> data)
Evaluates the two batch learners using the given data on the same set of
validation folds and returns the resulting information including the
confidence statistic that the two are different along with the summary
of their performance.
|
LearnerComparisonExperiment.Result<SummaryType> |
evaluate(Pair<BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>,BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>> learners,
java.util.Collection<? extends InputDataType> data)
Evaluates the two batch learners using the given data on the same set of
validation folds and returns the resulting information including the
confidence statistic that the two are different along with the summary
of their performance.
|
ConfidenceStatistic |
getConfidence()
Gets the confidence statistic that the two learners are different.
|
Pair<BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>,BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>> |
getLearners()
Gets the learners the experiment is being run on.
|
PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends FoldDataType>,? extends StatisticType> |
getPerformanceEvaluator()
Gets the performance evaluator to apply to each fold.
|
NullHypothesisEvaluator<java.util.Collection<? extends StatisticType>> |
getStatisticalTest()
Gets the statistical test to use to determine if the two learners are
significantly different.
|
DefaultPair<java.util.ArrayList<StatisticType>,java.util.ArrayList<StatisticType>> |
getStatistics()
Gets the performance evaluations for the trials of the experiment.
|
DefaultPair<SummaryType,SummaryType> |
getSummaries()
Gets the summaries of the experiment.
|
Summarizer<? super StatisticType,? extends SummaryType> |
getSummarizer()
Gets the summarizer of the performance evaluations.
|
protected void |
runTrial(PartitionedDataset<FoldDataType> fold)
Runs a single trial of the experiment on one fold of the data.
|
protected void |
setConfidence(ConfidenceStatistic confidence)
Sets the confidence statistic that the two learners are different.
|
protected void |
setLearners(Pair<BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>,BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>> learners)
Sets the learners the experiment is being run on.
|
void |
setPerformanceEvaluator(PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends FoldDataType>,? extends StatisticType> performanceEvaluator)
Sets the performance evaluator to apply to each fold.
|
void |
setStatisticalTest(NullHypothesisEvaluator<java.util.Collection<? extends StatisticType>> statisticalTest)
Sets the statistical test to use to determine if the two learners are
significantly different.
|
protected void |
setStatistics(DefaultPair<java.util.ArrayList<StatisticType>,java.util.ArrayList<StatisticType>> statistics)
Sets the performance evaluations for the trials of the experiment.
|
protected void |
setSummaries(DefaultPair<SummaryType,SummaryType> summaries)
Sets the summaries of the experiment.
|
void |
setSummarizer(Summarizer<? super StatisticType,? extends SummaryType> summarizer)
Sets the summarizer of the performance evaluations.
|
getFoldCreator, getNumTrials, runExperiment, setFoldCreator, setNumTrials
addListener, fireExperimentEnded, fireExperimentStarted, fireTrialEnded, fireTrialStarted, getListeners, removeListener, setListeners
clone
protected PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends FoldDataType>,? extends StatisticType> performanceEvaluator
protected Summarizer<? super StatisticType,? extends SummaryType> summarizer
protected Pair<BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>,BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>> learners
protected DefaultPair<java.util.ArrayList<StatisticType>,java.util.ArrayList<StatisticType>> statistics
protected ConfidenceStatistic confidence
protected DefaultPair<SummaryType,SummaryType> summaries
public LearnerComparisonExperiment()
public LearnerComparisonExperiment(ValidationFoldCreator<InputDataType,FoldDataType> foldCreator, PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends FoldDataType>,? extends StatisticType> performanceEvaluator, NullHypothesisEvaluator<java.util.Collection<? extends StatisticType>> statisticalTest, Summarizer<? super StatisticType,? extends SummaryType> summarizer)
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.statisticalTest
- The statistical test to apply to the performance
results of the two learners to determine if they are
statistically different.summarizer
- The summarizer for summarizing the result of the
performance evaluator from all the folds.public LearnerComparisonExperiment.Result<SummaryType> evaluate(Pair<BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>,BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>> learners, java.util.Collection<? extends InputDataType> data)
learners
- The two learners.data
- The data to use.protected void runTrial(PartitionedDataset<FoldDataType> fold)
runTrial
in class AbstractValidationFoldExperiment<InputDataType,FoldDataType>
fold
- The fold to run the trial of the experiment on.public LearnerComparisonExperiment.Result<SummaryType> evaluate(BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType> learner1, BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType> learner2, java.util.Collection<? extends InputDataType> data)
learner1
- The first learner.learner2
- The second learner.data
- The data to use.public PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends FoldDataType>,? extends StatisticType> getPerformanceEvaluator()
public void setPerformanceEvaluator(PerformanceEvaluator<? super LearnedType,? super java.util.Collection<? extends FoldDataType>,? 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 NullHypothesisEvaluator<java.util.Collection<? extends StatisticType>> getStatisticalTest()
public void setStatisticalTest(NullHypothesisEvaluator<java.util.Collection<? extends StatisticType>> statisticalTest)
statisticalTest
- The statistical test.public Pair<BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>,BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>> getLearners()
protected void setLearners(Pair<BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>,BatchLearner<? super java.util.Collection<? extends FoldDataType>,? extends LearnedType>> learners)
learners
- The learners.public DefaultPair<java.util.ArrayList<StatisticType>,java.util.ArrayList<StatisticType>> getStatistics()
protected void setStatistics(DefaultPair<java.util.ArrayList<StatisticType>,java.util.ArrayList<StatisticType>> statistics)
statistics
- The performance evaluations for the trials of the experiment.public ConfidenceStatistic getConfidence()
protected void setConfidence(ConfidenceStatistic confidence)
confidence
- The confidence statistic of the experiment.public DefaultPair<SummaryType,SummaryType> getSummaries()
protected void setSummaries(DefaultPair<SummaryType,SummaryType> summaries)
summaries
- The summaries of the experiment.