MemberType - The type of the members of this weighted ensemble.public class AbstractWeightedEnsemble<MemberType> extends AbstractCloneableSerializable implements Ensemble<WeightedValue<MemberType>>
Ensemble interface for ensembles
that have a weight associated with each member. Implements the ensemble as a
list of weighted values.| 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.
|
| Constructor and Description |
|---|
AbstractWeightedEnsemble()
Creates a new, empty of AbstractWeightedEnsemble.
|
AbstractWeightedEnsemble(java.util.List<WeightedValue<MemberType>> members)
Creates a new instance of AbstractWeightedEnsemble.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(MemberType member)
Adds the given regression function with a default weight of 1.0.
|
void |
add(MemberType member,
double weight)
Adds the given regression function with a given weight.
|
AbstractWeightedEnsemble<MemberType> |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
int |
getMemberCount()
Gets the number of members in the ensemble.
|
java.util.List<WeightedValue<MemberType>> |
getMembers()
Gets the members of the ensemble.
|
double |
getWeightSum()
Gets the sum of the weights of the ensemble members.
|
void |
setMembers(java.util.List<WeightedValue<MemberType>> members)
Sets the members of the ensemble.
|
public static final double DEFAULT_WEIGHT
protected java.util.List<WeightedValue<MemberType>> members
public AbstractWeightedEnsemble()
public AbstractWeightedEnsemble(java.util.List<WeightedValue<MemberType>> members)
members - The members of the ensemble.public AbstractWeightedEnsemble<MemberType> clone()
AbstractCloneableSerializableObject class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone() to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone() as the basis for your implementation.clone in interface CloneableSerializableclone in class AbstractCloneableSerializablepublic void add(MemberType member)
member - The regression function to add.public void add(MemberType member, double weight)
member - The regression function to add.weight - The weight for the new member.public int getMemberCount()
public double getWeightSum()
public java.util.List<WeightedValue<MemberType>> getMembers()
getMembers in interface Ensemble<WeightedValue<MemberType>>public void setMembers(java.util.List<WeightedValue<MemberType>> members)
members - The members of the ensemble.