Bhattacharyya distance

In statistics, the Bhattacharyya distance is a quantity which represents a notion of similarity between two probability distributions. It is closely related to the Bhattacharyya coefficient, which is a measure of the amount of overlap between two statistical samples or populations.

It is not a metric, despite being named a "distance", since it does not obey the triangle inequality.

History
Both the Bhattacharyya distance and the Bhattacharyya coefficient are named after Anil Kumar Bhattacharyya, a statistician who worked in the 1930s at the Indian Statistical Institute. He has developed this through a series of papers. He developed the method to measure the distance between two non-normal distributions and illustrated this with the classical multinomial populations, this work despite being submitted for publication in 1941, appeared almost five years later in Sankhya. Consequently, Professor Bhattacharyya started working toward developing a distance metric for probability distributions that are absolutely continuous with respect to the Lebesgue measure and published his progress in 1942, at Proceedings of the Indian Science Congress and the final work has appeared in 1943 in the Bulletin of the Calcutta Mathematical Society.

Definition
For probability distributions $$P$$ and $$Q$$ on the same domain $$\mathcal{X}$$, the Bhattacharyya distance is defined as
 * $$D_B(P,Q) = -\ln \left( BC(P,Q) \right)$$

where
 * $$BC(P,Q) = \sum_{x\in \mathcal{X}} \sqrt{P(x) Q(x)}$$

is the Bhattacharyya coefficient for discrete probability distributions.

For continuous probability distributions, with $$P(dx) = p(x)dx$$ and $$Q(dx) = q(x) dx$$ where $$p(x)$$ and $$q(x)$$ are the probability density functions, the Bhattacharyya coefficient is defined as
 * $$BC(P,Q) = \int_{\mathcal{X}} \sqrt{p(x) q(x)}\, dx$$.

More generally, given two probability measures $$P, Q$$ on a measurable space $$(\mathcal X, \mathcal B)$$, let $$\lambda$$  be a (sigma finite) measure such that $$P$$ and $$Q$$ are absolutely continuous with respect to $$\lambda$$  i.e. such that $$P(dx) = p(x)\lambda(dx)$$, and $$Q(dx) = q(x)\lambda(dx)$$ for probability density functions $$p, q$$ with respect to $$\lambda$$ defined $$\lambda$$-almost everywhere. Such a measure, even such a probability measure, always exists, e.g. $$\lambda = \tfrac12(P + Q)$$. Then define the Bhattacharyya measure on $$(\mathcal X, \mathcal B)$$ by
 * $$ bc(dx |P,Q) = \sqrt{p(x)q(x)}\, \lambda(dx) = \sqrt{\frac{P(dx)}{\lambda(dx)}(x)\frac{Q(dx)}{\lambda(dx)}(x)}\lambda(dx).$$

It does not depend on the measure $$\lambda$$, for if we choose a measure $$\mu$$ such that $$\lambda$$ and an other measure choice $$\lambda'$$ are absolutely continuous i.e. $$\lambda = l(x)\mu$$ and $$\lambda' = l'(x) \mu$$, then
 * $$P(dx) = p(x)\lambda(dx) = p'(x)\lambda'(dx) = p(x)l(x) \mu(dx) = p'(x)l'(x)\mu(dx)$$,

and similarly for $$Q$$. We then have
 * $$bc(dx |P,Q) = \sqrt{p(x) q(x)}\, \lambda(dx) = \sqrt{p(x)q(x)}\, l(x)\mu(x) = \sqrt{p(x)l(x)q(x)\, l(x)}\mu(dx) = \sqrt{p'(x)l'(x) q'(x)l'(x)}\, \mu(dx) = \sqrt{p'(x)q'(x)}\,\lambda'(dx)$$.

We finally define the Bhattacharyya coefficient
 * $$ BC(P,Q) = \int_{\mathcal X} bc(dx|P,Q) = \int_{\mathcal{X}} \sqrt{p(x) q(x)}\, \lambda(dx)$$.

By the above, the quantity $$BC(P,Q)$$ does not depend on $$\lambda$$, and by the Cauchy inequality $$0\le BC(P,Q) \le 1 $$. In particular if $$P(dx) = p(x)Q(dx)$$ is absolutely continuous wrt to $$Q$$ with Radon Nikodym derivative $$p(x) = \frac{P(dx)}{Q(dx)}(x)$$, then $$BC(P, Q) = \int_{\mathcal X} \sqrt{p(x)} Q(dx) = \int_{\mathcal X} \sqrt{\frac{P(dx)}{Q(dx)}} Q(dx) = E_Q\left[\sqrt{\frac{P(dx)}{Q(dx)}}\right] $$

Gaussian case
Let $$p\sim\mathcal{N}(\mu_p,\sigma_p^2)$$, $$q\sim\mathcal{N}(\mu_q,\sigma_q^2)$$, where $${\mathcal {N}}(\mu ,\sigma ^{2})$$ is the normal distribution with mean $$\mu$$ and variance $$\sigma^2$$; then


 * $$D_B(p,q) = \frac{1}{4} \frac{(\mu_p-\mu_q)^{2}}{\sigma_p^2+\sigma_q^2} + \frac 1 2 \ln\left(\frac{\sigma^2_p + \sigma^2_q}{2\sigma_p\sigma_q}\right)$$.

And in general, given two multivariate normal distributions $$p_i=\mathcal{N}(\boldsymbol\mu_i,\,\boldsymbol\Sigma_i)$$,
 * $$D_B(p_1, p_2)={1\over 8}(\boldsymbol\mu_1-\boldsymbol\mu_2)^T \boldsymbol\Sigma^{-1}(\boldsymbol\mu_1-\boldsymbol\mu_2)+{1\over 2}\ln \,\left({\det \boldsymbol\Sigma \over \sqrt{\det \boldsymbol\Sigma_1 \, \det \boldsymbol\Sigma_2} }\right)$$,

where $$\boldsymbol\Sigma={\boldsymbol\Sigma_1+\boldsymbol\Sigma_2 \over 2}.$$ Note that the first term is a squared Mahalanobis distance.

Properties
$$0 \le BC \le 1$$ and $$0 \le D_B \le \infty$$.

$$D_B$$ does not obey the triangle inequality, though the Hellinger distance $$\sqrt{1-BC(p,q)}$$ does.

Bounds on Bayes Error
The Bhattacharyya distance can be used to upper and lower bound the Bayes error rate:

where $$\rho = \mathbb E \sqrt {\eta(X)(1-\eta(X))}$$ and $$\eta(X) = \mathbb P(Y=1 | X)$$ is the posterior probability.

Applications
The Bhattacharyya coefficient quantifies the "closeness" of two random statistical samples.

Given two sequences from distributions $$P, Q$$, bin them into $$n$$ buckets, and let the frequency of samples from $$P$$ in bucket $$i$$ be $$p_i$$, and similarly for $$q_i$$, then the sample Bhattacharyya coefficient is


 * $$BC(\mathbf{p},\mathbf{q}) = \sum_{i=1}^n \sqrt{p_i q_i},$$

which is an estimator of $$BC(P, Q)$$. The quality of estimation depends on the choice of buckets; too few buckets would overestimate $$BC(P, Q)$$, while too many would underestimate.

A common task in classification is estimating the separability of classes. Up to a multiplicative factor, the squared Mahalanobis distance is a special case of the Bhattacharyya distance when the two classes are normally distributed with the same variances. When two classes have similar means but significantly different variances, the Mahalanobis distance would be close to zero, while the Bhattacharyya distance would not be.

The Bhattacharyya coefficient is used in the construction of polar codes.

The Bhattacharyya distance is used in feature extraction and selection, image processing, speaker recognition, phone clustering, and in genetics.