API Reference / capymoa /

bayesian.py

CapyMOA bayesian wrappers.

Incremental Bayesian learners backed by CapyMOA/MOA. Registered under capymoa. hub keys, mirroring the native TuiML bayesian family.

Classes

NaiveBayes

class capymoa.bayesian.NaiveBayes(_CapyMOAStreamMixin, Classifier)

Incremental Naive Bayes classifier (hub key capymoa.NaiveBayes).

Wraps NaiveBayes. Maintains per-class feature statistics that are updated one instance at a time, so the model can be trained on data that does not fit in memory and keeps learning as new instances arrive.
Constructor
__init__(
    self,
)

Attributes

schema_
capymoa.stream.Schema
Stream schema derived from the training data.
learner_
capymoa.classifier.NaiveBayes
The fitted backing CapyMOA learner.

Notes

Requires the optional CapyMOA extra: pip install 'tuiml[capymoa]'. A good first baseline for streaming classification: fast, single-pass, and surprisingly robust under gradual concept drift.
python
>>> from tuiml.capymoa import NaiveBayes
>>> from tuiml.datasets.generators import Agrawal
>>> data = Agrawal(n_samples=1000, function=1, random_state=42).generate()
>>> model = NaiveBayes().fit(data.X, data.y)
>>> model.predict(data.X[:5]).shape
(5,)

Methods

__init__ (self)
get_parameter_schema (cls) -> Dict[str, Any]

Return JSON Schema for constructor parameters.

get_capabilities (cls) -> List[str]

Return the capability names this wrapper supports.