medpy.metric.histogram.relative_deviation#

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

Calculate the deviation between two histograms.

The relative deviation between two histograms \(H\) and \(H'\) of size \(m\) is defined as:

\[d_{rd}(H, H') = \frac{ \sqrt{\sum_{m=1}^M(H_m - H'_m)^2} }{ \frac{1}{2} \left( \sqrt{\sum_{m=1}^M H_m^2} + \sqrt{\sum_{m=1}^M {H'}_m^2} \right) }\]

Attributes:

  • semimetric (triangle equation satisfied?)

Attributes for normalized histograms:

  • \(d(H, H')\in[0, \sqrt{2}]\)

  • \(d(H, H) = 0\)

  • \(d(H, H') = d(H', H)\)

Attributes for not-normalized histograms:

  • \(d(H, H')\in[0, 2]\)

  • \(d(H, H) = 0\)

  • \(d(H, H') = d(H', H)\)

Attributes for not-equal histograms:

  • not applicable

Parameters:
h1sequence

The first histogram.

h2sequence

The second histogram, same bins as h1.

Returns:
relative_deviationfloat

Relative deviation between the two histograms.