bulk_tanimoto_count_distance#

skfp.distances.bulk_tanimoto_count_distance(X: list | ndarray | csr_array, Y: list | ndarray | csr_array | None = None) ndarray#

Bulk Tanimoto distance for vectors of count values.

Computes the pairwise Tanimoto distance between count matrices. If one array is passed, distances are computed between its rows. For two arrays, distances 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 tanimoto_count_distance().

Parameters:
  • X (ndarray or CSR sparse array) – First binary input array or sparse matrix, of shape \(m \times d\)

  • Y (ndarray or CSR sparse array, default=None) – Second binary input array or sparse matrix, of shape \(n \times d\). If not passed, distances are computed between rows of X.

Returns:

distances – Array with pairwise Tanimoto distance values. Shape is \(m \times n\) if two arrays are passed, or \(m \times m\) otherwise.

Return type:

ndarray

See also

tanimoto_count_distance()

Tanimoto distance function for two vectors

Examples

>>> from skfp.distances import bulk_tanimoto_count_distance
>>> import numpy as np
>>> X = np.array([[1, 0, 1], [1, 0, 1]])
>>> Y = np.array([[1, 0, 1], [1, 0, 1]])
>>> dist = bulk_tanimoto_count_distance(X, Y)
>>> dist
array([[0., 0.],
       [0., 0.]])
>>> X = np.array([[1, 0, 1], [1, 0, 1]])
>>> dist = bulk_tanimoto_count_distance(X)
>>> dist
array([[0., 0.],
       [0., 0.]])