bundles / scipy 1.17.1 / scipy / spatial / distance / dice
function
scipy.spatial.distance:dice
source: /scipy/spatial/distance.py :1343
Signature
def dice ( u , v , w = None ) Summary
Compute the Dice dissimilarity between two boolean 1-D arrays.
Extended Summary
The Dice dissimilarity between u and v, is
where is the number of occurrences of and for .
Parameters
u: (N,) array_like, boolInput 1-D array.
v: (N,) array_like, boolInput 1-D array.
w: (N,) array_like, optionalThe weights for each value in
uandv. Default is None, which gives each value a weight of 1.0
Returns
dice: doubleThe Dice dissimilarity between 1-D arrays
uandv.
Notes
This function computes the Dice dissimilarity index. To compute the Dice similarity index, convert one to the other with similarity = 1 - dissimilarity.
Examples
from scipy.spatial import distance distance.dice([1, 0, 0], [0, 1, 0]) distance.dice([1, 0, 0], [1, 1, 0]) distance.dice([1, 0, 0], [2, 0, 0])✓
Aliases
-
scipy.spatial.distance.dice