#### Previous topic

medpy.metric.histogram.euclidean

#### Next topic

medpy.metric.histogram.histogram_intersection

# medpy.metric.histogram.fidelity_based¶

medpy.metric.histogram.fidelity_based(h1, h2)[source]

Fidelity based distance.

Also Bhattacharyya distance; see also the extensions noelle_1 to noelle_5.

The metric between two histograms $$H$$ and $$H'$$ of size $$m$$ is defined as:

$d_{F}(H, H') = \sum_{m=1}^M\sqrt{H_m * H'_m}$

Attributes:

• not a metric, a similarity

Attributes for normalized histograms:

• $$d(H, H')\in[0, 1]$$
• $$d(H, H) = 1$$
• $$d(H, H') = d(H', H)$$

Attributes for not-normalized histograms:

• not applicable

Attributes for not-equal histograms:

• not applicable
Parameters: h1 : sequence The first histogram, normalized. h2 : sequence The second histogram, normalized, same bins as h1. fidelity_based : float Fidelity based distance.

Notes

The fidelity between two histograms $$H$$ and $$H'$$ is the same as the cosine between their square roots $$\sqrt{H}$$ and $$\sqrt{H'}$$.