Crate fast_distances

Crate fast_distances 

Source

Modules§

utils

Functions§

approx_log_gamma
Approximate the logarithm of the Gamma function (log(Γ(x))) using Stirling’s approximation. This approximation is valid for x > 0.
bray_curtis
Computes the Bray-Curtis dissimilarity between two vectors.
bray_curtis_grad
Computes the Bray-Curtis dissimilarity and its gradient between two vectors.
canberra
Computes the Canberra distance between two vectors x and y.
canberra_grad
Computes the Canberra distance and its gradient with respect to the first vector x.
chebyshev
Chebyshev or l-infinity distance.
chebyshev_grad
Chebyshev or l-infinity distance with gradient.
correlation
Computes the Pearson correlation coefficient between two vectors x and y.
cosine
Computes the cosine similarity between two vectors x and y.
cosine_grad
Computes the cosine similarity and its gradient between two vectors x and y.
dice
Computes the Dice coefficient between two binary vectors.
euclidean
Computes the Euclidean distance between two vectors.
euclidean_grad
Computes the Euclidean distance and its gradient between two vectors.
hamming
Computes the Hamming distance between two vectors x and y.
haversine
Computes the Haversine distance between two points on the Earth’s surface.
haversine_grad
Computes the gradient of the Haversine distance between two points on the Earth’s surface.
hellinger
Computes the Hellinger distance between two vectors x and y.
hellinger_grad
Computes the Hellinger gradient and the Hellinger distance between two vectors x and y.
hyperboloid_grad
Computes the hyperboloid distance and gradient between two vectors x and y.
jaccard
Computes the Jaccard similarity between two binary vectors.
kulsinski
Computes the Kulsinski similarity between two binary vectors.
ll_dirichlet
Calculates the symmetric relative log likelihood (log Dirichlet likelihood) of rolling data2 versus data1 in n2 trials on a die that rolled data1 in n1 trials.
log_beta
Approximate the logarithm of the Beta function (log(B(x, y))) using two cases:
log_single_beta
Approximate the log of the single Beta function, as defined in the given Python function.
mahalanobis
Computes the Mahalanobis distance between two vectors x and y using the inverse covariance matrix vinv.
mahalanobis_grad
Computes the Mahalanobis distance and its gradient with respect to x using the inverse covariance matrix vinv.
manhattan
Computes the Manhattan, taxicab, or L1 distance between two vectors.
manhattan_grad
Manhattan, taxicab, or l1 distance with gradient.
matching
Computes the Matching similarity between two binary vectors.
minkowski
Minkowski distance.
minkowski_grad
Minkowski distance with gradient.
poincare
Computes the Poincaré distance between two vectors.
rogers_tanimoto
Computes the Rogers-Tanimoto similarity between two binary vectors.
russell_rao
Computes the Russell-Rao similarity between two binary vectors.
sokal_michener
Computes the Sokal-Michener similarity between two binary vectors.
sokal_sneath
Computes the Sokal-Sneath similarity between two binary vectors.
standardised_euclidean
Computes the standardised Euclidean distance between two vectors.
standardised_euclidean_grad
Euclidean distance standardised against a vector of standard deviations per coordinate with gradient.
weighted_minkowski
Computes the weighted Minkowski distance between two vectors x and y with optional weights w and a parameter p (defaulting to 2 for Euclidean distance).
weighted_minkowski_grad
A weighted version of the Minkowski distance with gradient.
yule
Computes the Yule’s Q statistic (a measure of association between two binary variables).