---
source: https://iinventedlight.com/library/notes/naive-bayes.md
title: "Naive Bayes classifiers assume features are independent given the class"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (scikit-learn docs); Apache-2.0 (Apache Spark MLlib docs); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: scikit-learn User Guide, Naive Bayes, BSD-3-Clause (https://raw.githubusercontent.com/scikit-learn/scikit-learn/main/COPYING). Copyright (c) 2007-2026 The scikit-learn developers. Apache Spark MLlib classification docs, Apache-2.0 (https://raw.githubusercontent.com/apache/spark/master/LICENSE). Copyright 2014 and onwards The Apache Software Foundation. NOTICE: https://raw.githubusercontent.com/apache/spark/master/NOTICE."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-16
status: published
approved_by: "Cole Withington, 2026-11-16 11:28 PT, Librarian chat widget t55s332: \"Yes, publish all 5 Monday gap notes\""
checked_on: 2026-11-16
as_of: 2026-11-16
confidence: medium
untested: "No classifier was trained for this note; only the fetched documentation was read."
category: coding-references
topic_area: "code-python: naive Bayes classifiers"
tags: [naive-bayes, naive, bayes, scikit-learn, spark, classification]
client: Librarian
sources:
  - id: S1
    title: "Naive Bayes"
    publisher: scikit-learn User Guide
    url: https://scikit-learn.org/stable/modules/naive_bayes.html
    accessed: 2026-11-16
    license: "BSD-3-Clause"
  - id: S2
    title: "Naive Bayes (MLlib classification)"
    publisher: Apache Spark
    url: https://spark.apache.org/docs/latest/ml-classification-regression.html#naive-bayes
    accessed: 2026-11-16
    license: "Apache-2.0"
---
# Naive Bayes classifiers assume features are independent given the class
**Answer:** Naive Bayes methods are supervised learning algorithms. They apply Bayes' theorem with a naive assumption: features are conditionally independent given the class.

## What the assumption buys you

In spite of that over-simplified assumption, these classifiers have done well in practice, including document classification and spam filtering. They can estimate their parameters from only a little training data. They can also be extremely fast compared with more sophisticated methods, because each feature's class-conditional distribution is fit on its own as one dimension.

On the flip side, it can be a decent classifier and still be a bad estimator. Do not take `predict_proba` outputs too seriously.

## Spark MLlib

Spark MLlib treats naive Bayes as a simple, probabilistic, multiclass classifier family. It applies Bayes' theorem and assumes strong independence between every pair of features. Training is very efficient. A single pass over the training data is enough to compute each feature's conditional probability distribution given each label.

MLlib supports Multinomial, Complement, Bernoulli, and Gaussian variants. Multinomial, Complement, and Bernoulli models are typically used for document classification. A feature's value may be the frequency of the term, or a zero or one.

## See also

- [numpy-broadcasting](https://iinventedlight.com/library/notes/numpy-broadcasting/)
- [pandas-data-structures](https://iinventedlight.com/library/notes/pandas-data-structures/)
- [sklearn-data-leakage](https://iinventedlight.com/library/notes/sklearn-data-leakage/)
- [sklearn-preprocessing-scaling](https://iinventedlight.com/library/notes/sklearn-preprocessing-scaling/)

## Claims

- id: C1
  claim: Naive Bayes methods are supervised learning algorithms.
  source: S1
  evidence: "Naive Bayes methods are a set of supervised learning algorithms"

- id: C2
  claim: The core assumption is conditional independence of features given the class.
  source: S1
  evidence: "the \"naive\" assumption of conditional independence between every pair"

- id: C3
  claim: Spark can train naive Bayes in a single pass over the data.
  source: S2
  evidence: "With a single pass over the training data,"

- id: C4
  claim: Spark presents naive Bayes as efficient to train.
  source: S2
  evidence: "Naive Bayes can be trained very efficiently."

## Sources

- [S1] Naive Bayes. scikit-learn User Guide. https://scikit-learn.org/stable/modules/naive_bayes.html . License: BSD-3-Clause. Accessed 2026-11-16.

- [S2] Naive Bayes (MLlib classification). Apache Spark. https://spark.apache.org/docs/latest/ml-classification-regression.html#naive-bayes . License: Apache-2.0. Accessed 2026-11-16.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: scikit-learn User Guide, Naive Bayes, BSD-3-Clause (https://raw.githubusercontent.com/scikit-learn/scikit-learn/main/COPYING). Copyright (c) 2007-2026 The scikit-learn developers. Apache Spark MLlib classification docs, Apache-2.0 (https://raw.githubusercontent.com/apache/spark/master/LICENSE). Copyright 2014 and onwards The Apache Software Foundation. NOTICE: https://raw.githubusercontent.com/apache/spark/master/NOTICE. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
