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

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.algorithm.baseline.WeightedMostFrequentLearner<OutputType>
Type Parameters:
OutputType - The output type of the data.
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 WeightedMostFrequentLearner<OutputType>
extends AbstractCloneableSerializable
implements SupervisedBatchLearner<Object,OutputType,ConstantEvaluator<OutputType>>

The WeightedMostFrequentLearner class implements a baseline learning algorithm that finds the most frequent output of a given dataset based on the weights of the examples.

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

Constructor Summary
WeightedMostFrequentLearner()
          Creates a new MostFrequentLearner.
 
Method Summary
 ConstantEvaluator<OutputType> learn(Collection<? extends InputOutputPair<? extends Object,OutputType>> data)
          Creates a constant evaluator based on the most frequent output in a given collection of input-output pairs, taking the weight into account.
 
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

WeightedMostFrequentLearner

public WeightedMostFrequentLearner()
Creates a new MostFrequentLearner.

Method Detail

learn

public ConstantEvaluator<OutputType> learn(Collection<? extends InputOutputPair<? extends Object,OutputType>> data)
Creates a constant evaluator based on the most frequent output in a given collection of input-output pairs, taking the weight into account.

Specified by:
learn in interface BatchLearner<Collection<? extends InputOutputPair<? extends Object,OutputType>>,ConstantEvaluator<OutputType>>
Parameters:
data - The data that the learning algorithm will use to create an object of ResultType.
Returns:
The object that is created based on the given data using the learning algorithm.