- dice(arr1, arr2, axis=None)[source]
Compute Dice’s similarity index between two numpy arrays. Arrays will be binarized before comparison.
This method was first proposed in Dice and Sorensen.
arr1, arr2 (array_like) – Input arrays, arrays to binarize and compare.
axis (None or int, optional) – Axis along which the DSIs are computed. The default is to compute the DSI of the flattened arrays.
float) – Dice-Sorenson index.
This implementation was based on https://gist.github.com/brunodoamaral/e130b4e97aa4ebc468225b7ce39b3137.