InputType
- The input type for the categorizer.MemberType
- The type of the members of the ensemble.@CodeReview(reviewer="Kevin R. Dixon", date="2008-07-23", changesNeeded=false, comments="Looks fine.") public class WeightedBinaryEnsemble<InputType,MemberType extends Evaluator<? super InputType,? extends java.lang.Boolean>> extends AbstractDiscriminantBinaryCategorizer<InputType> implements Ensemble<WeightedValue<MemberType>>
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.Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_WEIGHT
The default weight when adding a member is 1.0.
|
protected java.util.List<WeightedValue<MemberType>> |
members
The members of the ensemble.
|
BINARY_CATEGORIES
Constructor and Description |
---|
WeightedBinaryEnsemble()
Creates a new instance of WeightedBinaryEnsemble.
|
WeightedBinaryEnsemble(java.util.List<WeightedValue<MemberType>> members)
Creates a new instance of WeightedBinaryEnsemble.
|
Modifier and Type | Method and Description |
---|---|
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.
|
java.lang.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.
|
java.util.List<WeightedValue<MemberType>> |
getMembers()
Gets the members of the ensemble.
|
void |
setMembers(java.util.List<WeightedValue<MemberType>> members)
Sets the members of the ensemble.
|
evaluateWithDiscriminant
getCategories
clone
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCategories
clone
public static final double DEFAULT_WEIGHT
protected java.util.List<WeightedValue<MemberType extends Evaluator<? super InputType,? extends java.lang.Boolean>>> members
public WeightedBinaryEnsemble()
public WeightedBinaryEnsemble(java.util.List<WeightedValue<MemberType>> members)
members
- The members of the ensemble.public void add(MemberType member)
member
- The categorizer to add.public void add(MemberType member, double weight)
member
- The categorizer to add.weight
- The weight for the new member.public java.lang.Boolean evaluate(InputType input)
public double evaluateAsDouble(InputType input)
evaluateAsDouble
in interface DiscriminantBinaryCategorizer<InputType>
input
- The input to evaluate.public java.util.List<WeightedValue<MemberType>> getMembers()
getMembers
in interface Ensemble<WeightedValue<MemberType extends Evaluator<? super InputType,? extends java.lang.Boolean>>>
public void setMembers(java.util.List<WeightedValue<MemberType>> members)
members
- The members of the ensemble.