DynamicWeightedMajority#

class capymoa.classifier.DynamicWeightedMajority[source]#

Bases: MOAClassifier

Dynamic Weighted Majority Classifier.

Reference:

J. Zico Kolter and Marcus A. Maloof. Dynamic weighted majority: An ensemble method for drifting concepts. The Journal of Machine Learning Research, 8:2755-2790, December 2007. ISSN 1532-4435. URL http://dl.acm.org/citation.cfm?id=1314498.1390333.

Example usages:

>>> from capymoa.datasets import ElectricityTiny
>>> from capymoa.classifier import DynamicWeightedMajority
>>> from capymoa.evaluation import prequential_evaluation
>>> stream = ElectricityTiny()
>>> schema = stream.get_schema()
>>> learner = DynamicWeightedMajority(schema)
>>> results = prequential_evaluation(stream, learner, max_instances=1000)
>>> results["cumulative"].accuracy()
85.7
__init__(
schema: Schema,
random_seed: int = 1,
base_learner='bayes.NaiveBayes',
period: int = 50,
beta: float = 0.5,
theta: float = 0.01,
max_experts: int = 10000,
)[source]#

Dynamic Weighted Majority classifier

param: base_learner: the base learner to be used, default naive bayes. param: period: period between expert removal, creation, and weight update, default 50. param: beta: factor to punish mistakes by, default 0.5. param: theta: minimum fraction of weight per model, default 0.01. param: max_experts: maximum number of allowed experts, default unlimited.

CLI_help()[source]#
predict(instance)[source]#
predict_proba(instance)[source]#
train(instance)[source]#