gov.sandia.cognition.learning.function.summarizer
Class MostFrequentSummarizer<DataType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.function.summarizer.MostFrequentSummarizer<DataType>
Type Parameters:
DataType - Type of Data to summarize.
All Implemented Interfaces:
CloneableSerializable, Summarizer<DataType,DataType>, Serializable, Cloneable

public class MostFrequentSummarizer<DataType>
extends AbstractCloneableSerializable
implements Summarizer<DataType,DataType>

Summarizes a set of values by returning the most frequent value. If there is a tie, the first encountered value is returned.

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

Constructor Summary
MostFrequentSummarizer()
          Creates a new MostFrequentSummarizer.
 
Method Summary
 DataType summarize(Collection<? extends DataType> data)
          Summarizes the given data by returning the most frequent value.
 
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
 

Constructor Detail

MostFrequentSummarizer

public MostFrequentSummarizer()
Creates a new MostFrequentSummarizer.

Method Detail

summarize

public DataType summarize(Collection<? extends DataType> data)
Summarizes the given data by returning the most frequent value. If there are multiple values at the same (maximum) frequency, then the first one is used.

Specified by:
summarize in interface Summarizer<DataType,DataType>
Parameters:
data - The data to summarize.
Returns:
The most frequent value.