medpy.metric.histogram.cosine_1#
- medpy.metric.histogram.cosine_1(h1, h2)[source]#
Cosine simmilarity.
Turns the cosine similarity into a distance measure for normalized, positive histograms.
\[d_{\bar{\cos}}(H, H') = 1 - d_{\cos}(H, H')\]See
cosine
for the definition of \(d_{\cos}(H, H')\).Attributes:
metric
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:
not applicable
Attributes for not-equal histograms:
not applicable
- Parameters:
- h1sequence
The first histogram, normalized.
- h2sequence
The second histogram, normalized, same bins as
h1
.
- Returns:
- cosinefloat
Cosine distance.