gov.sandia.cognition.learning.algorithm.ensemble
Class VotingCategorizerEnsemble<InputType,CategoryType,MemberType extends Evaluator<? super InputType,? extends CategoryType>>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.function.categorization.AbstractCategorizer<InputType,CategoryType>
          extended by gov.sandia.cognition.learning.function.categorization.AbstractDiscriminantCategorizer<InputType,CategoryType,Double>
              extended by gov.sandia.cognition.learning.algorithm.ensemble.VotingCategorizerEnsemble<InputType,CategoryType,MemberType>
Type Parameters:
InputType - The type of the input to the ensemble. Passed on to each ensemble member categorizer to produce an output.
CategoryType - The type of the output of the ensemble. Also the output of ech ensemble member categorizer.
MemberType - The type of the members of the ensemble, which must be some extension of the Evaluator interface.
All Implemented Interfaces:
Evaluator<InputType,CategoryType>, Ensemble<MemberType>, Categorizer<InputType,CategoryType>, DiscriminantCategorizer<InputType,CategoryType,Double>, CloneableSerializable, Serializable, Cloneable

public class VotingCategorizerEnsemble<InputType,CategoryType,MemberType extends Evaluator<? super InputType,? extends CategoryType>>
extends AbstractDiscriminantCategorizer<InputType,CategoryType,Double>
implements Ensemble<MemberType>

An ensemble of categorizers that determine the result based on an equal-weight vote. The category with the most votes wins.

Since:
3.1.1
Author:
Justin Basilico
See Also:
WeightedVotingCategorizerEnsemble, Serialized Form

Field Summary
protected  List<MemberType> members
          The members of the ensemble.
 
Fields inherited from class gov.sandia.cognition.learning.function.categorization.AbstractCategorizer
categories
 
Constructor Summary
VotingCategorizerEnsemble()
          Creates a new, empty VotingCategorizerEnsemble.
VotingCategorizerEnsemble(Set<CategoryType> categories)
          Creates a new, empty VotingCategorizerEnsemble with the given set of categories.
VotingCategorizerEnsemble(Set<CategoryType> categories, List<MemberType> members)
          Creates a new VotingCategorizerEnsemble with the given set of categories and list of members.
 
Method Summary
 void add(MemberType member)
          Adds a given member to the ensemble.
 CategoryType evaluate(InputType input)
          Evaluates the function on the given input and returns the output.
 DefaultDataDistribution<CategoryType> evaluateAsVotes(InputType input)
          Evaluates the ensemble as votes.
 DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant(InputType input)
          Evaluate the categorizer on the given input to produce the expected category plus a discriminant for later producing an ordering of how well items fit into that category.
 List<MemberType> getMembers()
          Gets the members of the ensemble.
 void setMembers(List<MemberType> members)
          Sets the list of ensemble members.
 
Methods inherited from class gov.sandia.cognition.learning.function.categorization.AbstractCategorizer
clone, getCategories, setCategories
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.learning.function.categorization.Categorizer
getCategories
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Field Detail

members

protected List<MemberType extends Evaluator<? super InputType,? extends CategoryType>> members
The members of the ensemble.

Constructor Detail

VotingCategorizerEnsemble

public VotingCategorizerEnsemble()
Creates a new, empty VotingCategorizerEnsemble.


VotingCategorizerEnsemble

public VotingCategorizerEnsemble(Set<CategoryType> categories)
Creates a new, empty VotingCategorizerEnsemble with the given set of categories.

Parameters:
categories - The set of output categories for the ensemble.

VotingCategorizerEnsemble

public VotingCategorizerEnsemble(Set<CategoryType> categories,
                                 List<MemberType> members)
Creates a new VotingCategorizerEnsemble with the given set of categories and list of members.

Parameters:
categories - The set of output categories for the ensemble.
members - The list of ensemble members.
Method Detail

add

public void add(MemberType member)
Adds a given member to the ensemble.

Parameters:
member - The ensemble member to add.

evaluate

public CategoryType evaluate(InputType input)
Description copied from interface: Evaluator
Evaluates the function on the given input and returns the output.

Specified by:
evaluate in interface Evaluator<InputType,CategoryType>
Overrides:
evaluate in class AbstractDiscriminantCategorizer<InputType,CategoryType,Double>
Parameters:
input - The input to evaluate.
Returns:
The output produced by evaluating the input.

evaluateWithDiscriminant

public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant(InputType input)
Description copied from interface: DiscriminantCategorizer
Evaluate the categorizer on the given input to produce the expected category plus a discriminant for later producing an ordering of how well items fit into that category.

Specified by:
evaluateWithDiscriminant in interface DiscriminantCategorizer<InputType,CategoryType,Double>
Parameters:
input - The input value to categorize with a discriminate
Returns:
A pair containing the value and the discriminant value used for ordering results belonging to the same category.

evaluateAsVotes

public DefaultDataDistribution<CategoryType> evaluateAsVotes(InputType input)
Evaluates the ensemble as votes.

Parameters:
input - The input to evaluate.
Returns:
The counts of the votes of each ensemble member for each category.

getMembers

public List<MemberType> getMembers()
Description copied from interface: Ensemble
Gets the members of the ensemble.

Specified by:
getMembers in interface Ensemble<MemberType extends Evaluator<? super InputType,? extends CategoryType>>
Returns:
The members of the ensemble.

setMembers

public void setMembers(List<MemberType> members)
Sets the list of ensemble members.

Parameters:
members - The list of ensemble members.