Previous topic

medpy.metric.histogram.correlate

Next topic

medpy.metric.histogram.cosine

This Page

medpy.metric.histogram.correlate_1

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

Correlation distance.

Turns the histogram correlation into a distance measure for normalized, positive histograms.

\[d_{\bar{corr}}(H, H') = 1-\frac{d_{corr}(H, H')}{2}.\]

See correlate for the definition of \(d_{corr}(H, H')\).

Attributes:

  • semimetric

Attributes for normalized histograms:

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

Attributes for not-normalized histograms:

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

Attributes for not-equal histograms:

  • not applicable
Parameters:

h1 : sequence

The first histogram.

h2 : sequence

The second histogram, same bins as h1.

Returns:

correlate : float

Correlation distnace between the histograms.

Notes

Returns 0.5 if one of h1 or h2 contains only zeros.