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

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.function.categorization.AbstractBinaryCategorizer<InputType>
          extended by gov.sandia.cognition.learning.function.categorization.AbstractDiscriminantBinaryCategorizer<InputType>
              extended by gov.sandia.cognition.learning.algorithm.ensemble.WeightedBinaryEnsemble<InputType,MemberType>
Type Parameters:
InputType - The input type for the categorizer.
MemberType - The type of the members of the ensemble.
All Implemented Interfaces:
Evaluator<InputType,Boolean>, Ensemble<WeightedValue<MemberType>>, BinaryCategorizer<InputType>, Categorizer<InputType,Boolean>, DiscriminantBinaryCategorizer<InputType>, DiscriminantCategorizer<InputType,Boolean,Double>, CloneableSerializable, Serializable, Cloneable

@CodeReview(reviewer="Kevin R. Dixon",
            date="2008-07-23",
            changesNeeded=false,
            comments="Looks fine.")
public class WeightedBinaryEnsemble<InputType,MemberType extends Evaluator<? super InputType,? extends Boolean>>
extends AbstractDiscriminantBinaryCategorizer<InputType>
implements Ensemble<WeightedValue<MemberType>>

The WeightedBinaryEnsemble class implements an Ensemble of BinaryCategorizer objects where each categorizer is assigned a weight and the category is selected by choosing the one with the largest sum of weights.

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

Field Summary
static double DEFAULT_WEIGHT
          The default weight when adding a member is 1.0.
protected  List<WeightedValue<MemberType>> members
          The members of the ensemble.
 
Fields inherited from class gov.sandia.cognition.learning.function.categorization.AbstractBinaryCategorizer
BINARY_CATEGORIES
 
Constructor Summary
WeightedBinaryEnsemble()
          Creates a new instance of WeightedBinaryEnsemble.
WeightedBinaryEnsemble(List<WeightedValue<MemberType>> members)
          Creates a new instance of WeightedBinaryEnsemble.
 
Method Summary
 void add(MemberType member)
          Adds the given categorizer with a default weight of 1.0.
 void add(MemberType member, double weight)
          Adds the given categorizer with a given weight.
 Boolean evaluate(InputType input)
          Evaluates the ensemble.
 double evaluateAsDouble(InputType input)
          Evaluates the ensemble on the given input and returns the result as a double.
 List<WeightedValue<MemberType>> getMembers()
          Gets the members of the ensemble.
 void setMembers(List<WeightedValue<MemberType>> members)
          Sets the members of the ensemble.
 
Methods inherited from class gov.sandia.cognition.learning.function.categorization.AbstractDiscriminantBinaryCategorizer
evaluateWithDiscriminant
 
Methods inherited from class gov.sandia.cognition.learning.function.categorization.AbstractBinaryCategorizer
getCategories
 
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.learning.function.categorization.Categorizer
getCategories
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Field Detail

DEFAULT_WEIGHT

public static final double DEFAULT_WEIGHT
The default weight when adding a member is 1.0.

See Also:
Constant Field Values

members

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

Constructor Detail

WeightedBinaryEnsemble

public WeightedBinaryEnsemble()
Creates a new instance of WeightedBinaryEnsemble.


WeightedBinaryEnsemble

public WeightedBinaryEnsemble(List<WeightedValue<MemberType>> members)
Creates a new instance of WeightedBinaryEnsemble.

Parameters:
members - The members of the ensemble.
Method Detail

add

public void add(MemberType member)
Adds the given categorizer with a default weight of 1.0.

Parameters:
member - The categorizer to add.

add

public void add(MemberType member,
                double weight)
Adds the given categorizer with a given weight.

Parameters:
member - The categorizer to add.
weight - The weight for the new member.

evaluate

public Boolean evaluate(InputType input)
Evaluates the ensemble. It determines the output by combining the weighted output of each ensemble member.

Specified by:
evaluate in interface Evaluator<InputType,Boolean>
Overrides:
evaluate in class AbstractDiscriminantBinaryCategorizer<InputType>
Parameters:
input - The input to evaluate.
Returns:
The ensemble evaluated on the given input.

evaluateAsDouble

public double evaluateAsDouble(InputType input)
Evaluates the ensemble on the given input and returns the result as a double. If the double is greater than or equal to zero then the result is true and otherwise it is false. The number is based on the weighted sum of estimates.

Specified by:
evaluateAsDouble in interface DiscriminantBinaryCategorizer<InputType>
Parameters:
input - The input to evaluate.
Returns:
The ensemble evaluated on the given input.

getMembers

public List<WeightedValue<MemberType>> getMembers()
Gets the members of the ensemble.

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

setMembers

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

Parameters:
members - The members of the ensemble.