MOA 12.03
Real Time Analytics for Data Streams
moa.classifiers.meta.WeightedMajorityAlgorithm Class Reference

Weighted majority algorithm for data streams. More...

Inheritance diagram for moa.classifiers.meta.WeightedMajorityAlgorithm:
Collaboration diagram for moa.classifiers.meta.WeightedMajorityAlgorithm:

List of all members.

Public Member Functions

String getPurposeString ()
 Gets the purpose of this object.
void prepareForUseImpl (TaskMonitor monitor, ObjectRepository repository)
 This method describes the implementation of how to prepare this object for use.
void resetLearningImpl ()
 Resets this classifier.
void trainOnInstanceImpl (Instance inst)
 Trains this classifier incrementally using the given instance.
double[] getVotesForInstance (Instance inst)
 Predicts the class memberships for a given instance.
void getModelDescription (StringBuilder out, int indent)
 Returns a string representation of the model.
boolean isRandomizable ()
 Gets whether this classifier needs a random seed.
Classifier[] getSubClassifiers ()
 Gets the classifiers of this ensemble.
void discardModel (int index)

Public Attributes

ListOption learnerListOption
FloatOption betaOption
FloatOption gammaOption
FlagOption pruneOption

Protected Member Functions

Measurement[] getModelMeasurementsImpl ()
 Gets the current measurements of this classifier.
int removePoorestModelBytes ()

Protected Attributes

Classifier[] ensemble
double[] ensembleWeights

Detailed Description

Weighted majority algorithm for data streams.

Author:
Richard Kirkby (rkirkby@cs.waikato.ac.nz)
Version:
Revision:
7

Definition at line 42 of file WeightedMajorityAlgorithm.java.


Member Function Documentation

void moa.classifiers.meta.WeightedMajorityAlgorithm.discardModel ( int  index)

Definition at line 183 of file WeightedMajorityAlgorithm.java.

void moa.classifiers.meta.WeightedMajorityAlgorithm.getModelDescription ( StringBuilder  out,
int  indent 
) [virtual]

Returns a string representation of the model.

Parameters:
outthe stringbuilder to add the description
indentthe number of characters to indent

Implements moa.classifiers.AbstractClassifier.

Definition at line 156 of file WeightedMajorityAlgorithm.java.

Measurement [] moa.classifiers.meta.WeightedMajorityAlgorithm.getModelMeasurementsImpl ( ) [protected, virtual]

Gets the current measurements of this classifier.



The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. Note that this will produce compiler errors if not overridden.

Returns:
an array of measurements to be used in evaluation tasks

Implements moa.classifiers.AbstractClassifier.

Definition at line 161 of file WeightedMajorityAlgorithm.java.

String moa.classifiers.meta.WeightedMajorityAlgorithm.getPurposeString ( )

Gets the purpose of this object.

Returns:
the string with the purpose of this object

Reimplemented from moa.classifiers.AbstractClassifier.

Definition at line 47 of file WeightedMajorityAlgorithm.java.

Classifier [] moa.classifiers.meta.WeightedMajorityAlgorithm.getSubClassifiers ( )

Gets the classifiers of this ensemble.

Returns null if this classifier is a single classifier.

Returns:
an array of the classifiers of the ensemble

Reimplemented from moa.classifiers.AbstractClassifier.

Definition at line 179 of file WeightedMajorityAlgorithm.java.

double [] moa.classifiers.meta.WeightedMajorityAlgorithm.getVotesForInstance ( Instance  inst)

Predicts the class memberships for a given instance.

If an instance is unclassified, the returned array elements must be all zero.

Parameters:
instthe instance to be classified
Returns:
an array containing the estimated membership probabilities of the test instance in each class

Implements moa.classifiers.Classifier.

Definition at line 138 of file WeightedMajorityAlgorithm.java.

Here is the call graph for this function:

boolean moa.classifiers.meta.WeightedMajorityAlgorithm.isRandomizable ( )

Gets whether this classifier needs a random seed.

Examples of methods that needs a random seed are bagging and boosting.

Returns:
true if the classifier needs a random seed.

Implements moa.classifiers.Classifier.

Definition at line 174 of file WeightedMajorityAlgorithm.java.

void moa.classifiers.meta.WeightedMajorityAlgorithm.prepareForUseImpl ( TaskMonitor  monitor,
ObjectRepository  repository 
) [virtual]

This method describes the implementation of how to prepare this object for use.

All classes that extends this class have to implement prepareForUseImpl and not prepareForUse since prepareForUse calls prepareForUseImpl.

Parameters:
monitorthe TaskMonitor to use
repositorythe ObjectRepository to use

Reimplemented from moa.classifiers.AbstractClassifier.

Definition at line 81 of file WeightedMajorityAlgorithm.java.

Here is the call graph for this function:

int moa.classifiers.meta.WeightedMajorityAlgorithm.removePoorestModelBytes ( ) [protected]

Definition at line 199 of file WeightedMajorityAlgorithm.java.

void moa.classifiers.meta.WeightedMajorityAlgorithm.resetLearningImpl ( ) [virtual]

Resets this classifier.

It must be similar to starting a new classifier from scratch.

The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. Note that this will produce compiler errors if not overridden.

Implements moa.classifiers.AbstractClassifier.

Definition at line 103 of file WeightedMajorityAlgorithm.java.

void moa.classifiers.meta.WeightedMajorityAlgorithm.trainOnInstanceImpl ( Instance  inst) [virtual]

Trains this classifier incrementally using the given instance.



The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. Note that this will produce compiler errors if not overridden.

Parameters:
instthe instance to be used for training

Implements moa.classifiers.AbstractClassifier.

Definition at line 112 of file WeightedMajorityAlgorithm.java.


Member Data Documentation

Initial value:
 new FloatOption("beta", 'b',
            "Factor to punish mistakes by.", 0.9, 0.0, 1.0)

Definition at line 67 of file WeightedMajorityAlgorithm.java.

Initial value:
 new FloatOption("gamma", 'g',
            "Minimum fraction of weight per model.", 0.01, 0.0, 0.5)

Definition at line 70 of file WeightedMajorityAlgorithm.java.

Initial value:
 new ListOption(
            "learners",
            'l',
            "The learners to combine.",
            new ClassOption("learner", ' ', "", Classifier.class,
            "trees.HoeffdingTree"),
            new Option[]{
                new ClassOption("", ' ', "", Classifier.class,
                "trees.HoeffdingTree -l MC"),
                new ClassOption("", ' ', "", Classifier.class,
                "trees.HoeffdingTree -l NB"),
                new ClassOption("", ' ', "", Classifier.class,
                "trees.HoeffdingTree -l NBAdaptive"),
                new ClassOption("", ' ', "", Classifier.class, "bayes.NaiveBayes")},
            ',')

Definition at line 51 of file WeightedMajorityAlgorithm.java.

Initial value:
 new FlagOption("prune", 'p',
            "Prune poorly performing models from ensemble.")

Definition at line 73 of file WeightedMajorityAlgorithm.java.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations