The similarity between two probability distributions can be measured using the Bhattacharyya coefficient, defined as:
where we've defined the vectors
Note that, since probabilities add to one, the vectors
The Bhattacharyya coefficient is related to the Euclidean distance via
In that sense, if you know how to compute the Euclidean distance for
Fill in the code to calculate the Bhattacharyya coefficient for two probability distribution vectors
You can use numpy
functions such as the inner product np.inner
or np.linalg.norm
.
Don't forget to take the element-wise square root of the vectors! Use np.sqrt
.
To interact with codercises, please switch to a larger screen size.
Learning Objectives: