ArticleslgStudy

mathematics

Bayes classifier

Bayes classifier is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Bayes classifier rather than just read about it. In short: In statistical classification, the Bayes classifier is the classifier having the smallest probability of misclassification of all classes using the same set of features. Definition Suppose a pair (X,Y) takes values in ℝd×{1,2,…,K}, where Y is the class label of an element whose features are given by X.

Bayes classifier — main illustration
Bayes classifier — illustration

Key takeaways

  • Bayes classifier belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Bayes classifier to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Bayes classifier from memory before moving on to harder problems.

Reference excerpt

In statistical classification, the Bayes classifier is the classifier having the smallest probability of misclassification of all classes using the same set of features.

Definition Suppose a pair (X,Y) takes values in ℝd×{1,2,…,K}, where Y is the class label of an element whose features are given by X. Assume that the conditional distribution of X, given that the label Y takes the value r is given by (X∣Y=r)∼Prforr=1,2,…,K where "∼" means "is distributed as", and where Pr denotes a probability distribution. A classifier is a rule that assigns to an observation X=x a guess or estimate of what the unobserved label Y=r actually was. In theoretical terms, a classifier is a measurable function C:ℝd→{1,2,…,K}, with the interpretation that C classifies the point x to the class C(x). The probability of misclassification, or risk, of a classifier C is defined as ℛ(C)=P⁡{C(X)≠Y}. The Bayes classifier is CBayes(x)=argmaxr∈{1,2,…,K}P⁡(Y=r∣X=x). In practice, as in most of statistics, the difficulties and subtleties are associated with modeling the probability distributions effectively—in this case, P⁡(Y=r∣X=x). The Bayes classifier is a useful benchmark in statistical classification. The excess risk of a general classifier C (possibly depending on some training data) is defined as ℛ(C)−ℛ(CBayes). Thus this non-negative quantity is important for assessing the performance of different classification techniques. A classifier is said to be consistent if the excess risk converges to zero as the size of the training data set tends to infinity. Considering the components xi of x to be mutually independent, we get the naive Bayes classifier, where CBayes(x)=argmaxr∈{1,2,…,K}P⁡(Y=r)∏i=1dPr(xi).

Properties Proof that the Bayes classifier is optimal and Bayes error rate is minimal proceeds as follows. Define the variables: Risk R(h), Bayes risk R∗, all possible classes to which the points can be classified Y={0,1}. Let the posterior probability of a point belonging to class 1 be η(x)=Pr(Y=1|X=x). Define the classifier 𝒽∗as 𝒽∗(x)={1if η(x)⩾0.5,0otherwise. Then we have the following results:

Proof of (a): For any classifier h, we have R(h)=𝔼XY[𝕀{h(X)≠Y}]=𝔼X𝔼Y|X[𝕀{h(X)≠Y}]=𝔼X[η(X)𝕀{h(X)=0}+(1−η(X))𝕀{h(X)=1}] where the second line was derived through Fubini's theorem Notice that R(h) is minimised by taking ∀x∈X, h(x)={1if η(x)⩾1−η(x),0otherwise. Therefore the minimum possible risk is the Bayes risk, R∗=R(h∗). Proof of (b): R(h)−R∗=R(h)−R(h∗)=𝔼X[η(X)𝕀{h(X)=0}+(1−η(X))𝕀{h(X)=1}−η(X)𝕀{h∗(X)=0}−(1−η(X))𝕀{h∗(X)=1}]=𝔼X[|2η(X)−1|𝕀{h(X)≠h∗(X)}]=2𝔼X[|η(X)−0.5|𝕀{h(X)≠h∗(X)}]

Proof of (c): R(h∗)=𝔼X[η(X)𝕀{h∗(X)=0}+(1−η(X))𝕀{h∗(X)=1}]=𝔼X[min⁡(η(X),1−η(X))] Proof of (d): R(h∗)=𝔼X[min⁡(η(X),1−η(X))]=12−𝔼X[max⁡(η(X)−1/2,1/2−η(X))]=12−12𝔼[|2η(X)−1|]

General case The general case that the Bayes classifier minimises classification error when each element can belong to either of n categories proceeds by towering expectations as follows. 𝔼Y(𝕀{y≠ŷ})=𝔼X𝔼Y|X(𝕀{y≠ŷ}|X=x)=𝔼[Pr⁡(Y=1|X=x)𝕀{ŷ=2,3,…,n}+Pr⁡(Y=2|X=x)𝕀{ŷ=1,3,…,n}+⋯+Pr⁡(Y=n|X=x)𝕀{ŷ=1,2,3,…,n−1}] This is minimised by simultaneously minimizing all the terms of the expectation using the classifier h(x)=k,arg⁡maxkPr(Y=k|X=x) for each observation x.

See also Naive Bayes classifier

References

Worked examples

Example 1 — a first encounter with Bayes classifier

Start with the simplest possible case. Write down what Bayes classifier claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Bayes classifier before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Bayes classifier ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Bayes classifier

In research
Bayes classifier appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Bayes classifier in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Bayes classifier is common in secondary-school and first-year university syllabi. It links to neighbouring topics Bayesian statistics, Statistical classification, so understanding it makes those chapters shorter.
In everyday life
Look for Bayes classifier outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Bayes classifier” →

How to study Bayes classifier in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Bayes classifier means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Bayes classifier out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Bayes classifier in simple terms?

In statistical classification, the Bayes classifier is the classifier having the smallest probability of misclassification of all classes using the same set of features. Definition Suppose a pair (X,Y) takes values in ℝd×{1,2,…,K}, where Y is the class label of an element whose features are given b…

Why does Bayes classifier matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Bayes classifier?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Bayes classifier.

Tags

  • Bayesian statistics
  • Statistical classification

Keep exploring