gov.sandia.cognition.learning.algorithm.baseline
Class MostFrequentLearner<OutputType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.algorithm.baseline.MostFrequentLearner<OutputType>
Type Parameters:
OutputType - The type of the output.
All Implemented Interfaces:
BatchLearner<Collection<? extends InputOutputPair<? extends Object,OutputType>>,ConstantEvaluator<OutputType>>, SupervisedBatchLearner<Object,OutputType,ConstantEvaluator<OutputType>>, CloneableSerializable, Serializable, Cloneable

@CodeReview(reviewer="Kevin R. Dixon",
            date="2008-07-22",
            changesNeeded=false,
            comments={"Fixed a few typos in javadoc.","Removed implements Serializeable, as BatchLearner already does that.","I don\'t particularly like this class... I just don\'t think it\'s useful.","However, the code looks fine."})
public class MostFrequentLearner<OutputType>
extends AbstractCloneableSerializable
implements SupervisedBatchLearner<Object,OutputType,ConstantEvaluator<OutputType>>

The MostFrequentLearner class implements a baseline learner that computes the most frequent output value.

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

Constructor Summary
MostFrequentLearner()
          Creates a new MostFrequentLearner.
 
Method Summary
 ConstantEvaluator<OutputType> learn(Collection<? extends InputOutputPair<? extends Object,OutputType>> data)
          Creates a constant evaluator that for the most frequent output value of the given dataset.
 
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

MostFrequentLearner

public MostFrequentLearner()
Creates a new MostFrequentLearner.

Method Detail

learn

public ConstantEvaluator<OutputType> learn(Collection<? extends InputOutputPair<? extends Object,OutputType>> data)
Creates a constant evaluator that for the most frequent output value of the given dataset.

Specified by:
learn in interface BatchLearner<Collection<? extends InputOutputPair<? extends Object,OutputType>>,ConstantEvaluator<OutputType>>
Parameters:
data - The dataset of input-output pairs to use.
Returns:
A constant evaluator for the most frequent output value.