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.public class WeightedVotingCategorizerEnsemble<InputType,CategoryType,MemberType extends Evaluator<? super InputType,? extends CategoryType>> extends AbstractCategorizer<InputType,CategoryType> implements Ensemble<WeightedValue<MemberType>>, DiscriminantCategorizer<InputType,CategoryType,java.lang.Double>
| 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.
|
categories| Constructor and Description |
|---|
WeightedVotingCategorizerEnsemble()
Creates a new instance of WeightedVotingCategorizerEnsemble.
|
WeightedVotingCategorizerEnsemble(java.util.Set<CategoryType> categories)
Creates a new instance of WeightedVotingCategorizerEnsemble.
|
WeightedVotingCategorizerEnsemble(java.util.Set<CategoryType> categories,
java.util.List<WeightedValue<MemberType>> members)
Creates a new instance of WeightedVotingCategorizerEnsemble.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(MemberType categorizer)
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.
|
CategoryType |
evaluate(InputType input)
Evaluates the ensemble.
|
DefaultDataDistribution<CategoryType> |
evaluateAsVotes(InputType input)
Evaluates the ensemble on the given input and returns the distribution
of votes over the output categories.
|
DefaultWeightedValueDiscriminant<CategoryType> |
evaluateWithDiscriminant(InputType input)
Evaluates the ensemble on the given input and returns the category that
has the most weighted votes as a pair containing the category and the
percent of the weighted votes that it obtained.
|
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.
|
clone, getCategories, setCategoriesequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCategoriesclonepublic static final double DEFAULT_WEIGHT
protected java.util.List<WeightedValue<MemberType extends Evaluator<? super InputType,? extends CategoryType>>> members
public WeightedVotingCategorizerEnsemble()
public WeightedVotingCategorizerEnsemble(java.util.Set<CategoryType> categories)
categories - The set of categories that the ensemble can output.public WeightedVotingCategorizerEnsemble(java.util.Set<CategoryType> categories, java.util.List<WeightedValue<MemberType>> members)
categories - The set of categories that the ensemble can output.members - The members of the ensemble.public void add(MemberType categorizer)
categorizer - The categorizer to add.public void add(MemberType member, double weight)
member - The categorizer to add.weight - The weight for the new member. Cannot be negative.public CategoryType evaluate(InputType input)
evaluate in interface Evaluator<InputType,CategoryType>input - The input to evaluate.public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant(InputType input)
evaluateWithDiscriminant in interface DiscriminantCategorizer<InputType,CategoryType,java.lang.Double>input - The input to evaluate.public DefaultDataDistribution<CategoryType> evaluateAsVotes(InputType input)
input - The input to evaluate.public java.util.List<WeightedValue<MemberType>> getMembers()
getMembers in interface Ensemble<WeightedValue<MemberType extends Evaluator<? super InputType,? extends CategoryType>>>public void setMembers(java.util.List<WeightedValue<MemberType>> members)
members - The members of the ensemble.