scipy.spatial.distance.dice¶

scipy.spatial.distance.
dice
(u, v, w=None)[source]¶ Computes the Dice dissimilarity between two boolean 1D arrays.
The Dice dissimilarity between u and v, is
\[\frac{c_{TF} + c_{FT}} {2c_{TT} + c_{FT} + c_{TF}}\]where \(c_{ij}\) is the number of occurrences of \(\mathtt{u[k]} = i\) and \(\mathtt{v[k]} = j\) for \(k < n\).
Parameters: u : (N,) ndarray, bool
Input 1D array.
v : (N,) ndarray, bool
Input 1D array.
w : (N,) array_like, optional
The weights for each value in u and v. Default is None, which gives each value a weight of 1.0
Returns: dice : double
The Dice dissimilarity between 1D arrays u and v.