Skip to content
Quantoros

Why must the first naive Bayes partialfit call receive all expected class labels, even if its batch lacks some classes?

Classic MLLevel: IntermediateIncremental class vocabulary

Why must the first naive Bayes partial_fit call receive all expected class labels, even if its batch lacks some classes?

Hints
  • Initialization must describe the whole task.
  • One batch is not the class universe.

Answer

It initializes the complete class structure before accumulating incremental statistics. Otherwise a first batch cannot establish classes that only arrive in later batches.

Source and licence: scikit-learn 1.7.2 — naive bayes · BSD-3-Clause · answer: Quantoros editorial

Related questions