How to Find a Gaussian Classifier’s Decision Boundary
At a glance
- 1. Specify both classes
Write the mean, covariance, and prior probability for each class; one class-conditional Gaussian alone is not enough.
- 2. Compare posterior scores
Use the log likelihood plus log prior for each class, then set the two scores equal to find the boundary.
- 3. Check the covariances
Shared covariance gives a linear boundary; different covariances generally give a quadratic boundary.
- 4. Apply the decision rule
Classify on the side with the larger posterior score, accounting for any unequal error costs.
A Gaussian model does not determine a binary decision boundary by itself. You need a probability model for each class, along with the class prior probabilities and a rule for deciding which kinds of errors matter.
For the usual Bayes classifier with equal costs for misclassification, the boundary consists of points where the two class posterior probabilities are equal. The calculation also shows why a shared covariance matrix gives a straight boundary, while different covariance matrices usually produce a quadratic one.
Set up the two class models
Let the observed feature vector be , and let the class label be . Assume the class-conditional distributions are
with prior probabilities . Each covariance matrix is assumed to be positive definite so that the usual Gaussian density is defined.
Bayes’ rule says that the posterior probability of class is proportional to its prior times its class-conditional density:
With equal costs for the two types of classification error, predict class 1 when . The decision boundary is where these probabilities are equal.
General Gaussian boundary
Taking logarithms is convenient because it turns products into sums. After dropping the Gaussian constant , the score for class is
The boundary is the set of points satisfying
Predict class 1 where , and class 0 where . When and differ, the inverse-covariance terms generally leave squared and cross-product terms in . The boundary is therefore generally quadratic (though special parameter choices can simplify it).
Shared covariance gives a linear boundary
If both classes have the same covariance matrix, , their quadratic terms in cancel when you subtract the scores. The boundary becomes
This is a linear equation in the features. The normal vector to the boundary is ; the priors shift its position. If the priors are equal, the log-prior term vanishes. This shared-covariance model is often called linear discriminant analysis (LDA). The unequal-covariance Gaussian classifier is often called quadratic discriminant analysis (QDA).
Worked one-dimensional example
Suppose
and the class priors are and . The variance is shared, so there is a single threshold. Setting the two class scores equal gives
The score for class 1 increases with , so predict class 1 when and class 0 when . The more common class 0 pushes the threshold to the right of the midpoint, making the classifier require stronger evidence for class 1. At the threshold, the posterior probabilities are equal.
If the error costs differ
Equal posterior probabilities are the boundary only when the two kinds of error have equal cost. Let be the cost of predicting 1 when the true class is 0, and the cost of predicting 0 when the true class is 1. Predict class 1 when
The boundary is then where the posterior odds equal this cost ratio, rather than 1. The equal-cost rule is recovered when .
Common mistakes
- Using only one class distribution: A boundary compares classes. Knowing without does not determine where to classify.
- Ignoring priors: The means and covariances alone are not enough when the classes are not equally likely. Priors can move the boundary.
- Assuming every Gaussian boundary is linear: Linearity requires shared covariance (or another special simplification). Different covariance matrices usually yield a quadratic boundary.
- Confusing a density with a posterior: A point can have a larger likelihood under one class but still have a larger posterior under another if the prior probabilities differ.
If a problem gives just one Gaussian mean and covariance matrix, check whether it also specifies the competing class model, priors, and decision costs. Without those, there is no unique binary decision boundary.
References
- Pattern Recognition and Machine Learning, Christopher M. Bishop
- The Elements of Statistical Learning, Trevor Hastie, Robert Tibshirani, and Jerome Friedman
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.