def dice(u, v):
u = _validate_vector(u)<EOL>v = _validate_vector(v)<EOL>if u.dtype == np.bool:<EOL><INDENT>ntt = (u & v).sum()<EOL><DEDENT>else:<EOL><INDENT>ntt = (u * v).sum()<EOL><DEDENT>(nft, ntf) = _nbool_correspond_ft_tf(u, v)<EOL>return float(ntf + nft) / float(<NUM_LIT> * ntt + ntf + nft)<EOL>
Computes the Dice dissimilarity between two boolean 1-D arrays.

The Dice dissimilarity between `u` and `v`, is

.. math::

     \\frac{c_{TF} + c_{FT}}
          {2c_{TT} + c_{FT} + c_{TF}}

where :math:`c_{ij}` is the number of occurrences of
:math:`\\mathtt{u[k]} = i` and :math:`\\mathtt{v[k]} = j` for
:math:`k < n`.

Parameters
----------
u : (N,) ndarray, bool
    Input 1-D array.
v : (N,) ndarray, bool
    Input 1-D array.

Returns
-------
dice : double
    The Dice dissimilarity between 1-D arrays `u` and `v`.