osl_dynamics.inference.metrics.dice_coefficient#

osl_dynamics.inference.metrics.dice_coefficient(sequence_1, sequence_2)#

Calculates the Dice coefficient.

The Dice coefficient is 2 times the number of equal elements (equivalent to true-positives) divided by the sum of the total number of elements.

Parameters:
sequence_1np.ndarray

A sequence containing either 1D discrete or 2D continuous data. Shape must be (n_samples, n_states) or (n_samples,).

sequence_2np.ndarray

A sequence containing either 1D discrete or 2D continuous data. Shape must be (n_samples, n_states) or (n_samples,).

Returns:
dicefloat

The Dice coefficient of the two sequences.