bulk_dice_count_similarity#
- skfp.distances.bulk_dice_count_similarity(X: list | ndarray | csr_array, Y: list | ndarray | csr_array | None = None) ndarray#
Bulk Dice similarity for count matrices.
Computes the pairwise Dice similarity between count matrices. If one array is passed, similarities are computed between its rows. For two arrays, similarities are between their respective rows, with i-th row and j-th column in output corresponding to i-th row from the first array and j-th row from the second array.
See also
dice_count_similarity().- Parameters:
X (ndarray or CSR sparse array) – First count input array or sparse matrix, of shape \(m \times d\)
Y (ndarray or CSR sparse array, default=None) – Second count input array or sparse matrix, of shape \(n \times d\). If not passed, similarities are computed between rows of X.
- Returns:
similarities – Array with pairwise Dice similarity values. Shape is \(m \times n\) if two arrays are passed, or \(m \times m\) otherwise.
- Return type:
ndarray
See also
dice_count_similarity()Dice similarity function for two vectors.
Examples
>>> from skfp.distances import bulk_dice_count_similarity >>> import numpy as np >>> X = np.array([[1, 0, 1], [0, 0, 1]]) >>> Y = np.array([[1, 0, 1], [0, 1, 1]]) >>> sim = bulk_dice_count_similarity(X, Y) >>> sim array([[1. , 0.5 ], [0.66666667, 0.66666667]])