Two classes have one-dimensional Gaussian class-conditional densities with the same variance σ2, means μ1<μ2 and priors P(C1), P(C2). What is the Bayes decision boundary x∗ (derive it), and what is it for μ1=0, μ2=4, σ2=1, P(C1)=0.9, P(C2)=0.1, and which class is predicted at x=2.4?

Supervised learning, Bayes decision theory
Level L3 Intermediate. Length Medium. Nature Th+Mat Both.

What's being asked

Whether you can derive the boundary from the Bayes rule instead of quoting it, and see why unequal priors shift it.

Key idea

Predict the class with the larger ln⁡p(x∣Ck)+ln⁡P(Ck). With equal variances the x2 terms cancel, so the boundary is a single point: x∗=μ1+μ22+σ2μ2−μ1ln⁡P(C1)P(C2), the midpoint pushed towards the less likely class.

Steps

  1. This is the harder follow-up to `bayes-threshold-one-dimensional-gaussians`, which comes first. Bayes rule for minimum error: predict C1 when P(C1∣x)>P(C2∣x). The common factor p(x) cancels, so compare gk(x)=ln⁡p(x∣Ck)+ln⁡P(Ck).
  2. Insert the Gaussians: gk(x)=−12ln⁡(2πσ2)−(x−μk)22σ2+ln⁡P(Ck). The first term is the same for both classes and cancels.
  3. Set g1(x)=g2(x) and multiply by 2σ2: −(x−μ1)2+(x−μ2)2+2σ2ln⁡P(C1)P(C2)=0. Expand: the x2 terms cancel, leaving 2(μ2−μ1) x=μ22−μ12+2σ2ln⁡P(C1)P(C2).
  4. Divide by 2(μ2−μ1): x∗=μ1+μ22+σ2μ2−μ1ln⁡P(C1)P(C2). With equal priors the log is 0 and the boundary is the midpoint.
  5. Numbers: 0+42=2 and 14ln⁡0.90.1=14ln⁡9=2.19724=0.5493. So x∗=2.549.
  6. Since μ1<μ2, we predict C1 for x<x∗. The point x=2.4 is below 2.549, so the prediction is C1. With equal priors the boundary would be 2 and x=2.4 would go to C2: the large prior for C1 moves the boundary towards C2.
  7. If the variances differed, the x2 terms would not cancel and the boundary would be quadratic, with up to two points.

Common mistakes

How long your answer should be

Half a page, about 4 minutes.

Read this

Previous in Supervised learning: In Poisson regression the count y has mean μ=ewx (one weight, no intercept). The data are (x,y)=(1,1) and (2,3). What are the log-likelihood, its gradient and Hessian, and the result of two Newton steps from w=0?
Next in Supervised learning: The Huber loss with threshold δ is ℓ(r)=12r2 for ∣r∣≤δ and δ(∣r∣−12δ) otherwise, where r is the residual. How do you derive ℓ′(r), show that ℓ is convex, and use this to show that the optimal constant c for the data {1,2,3,4,100} with δ=1.5 is c=3?