metric – implementation of the cocktail distance coefficient

cockatoo.metric.distance(ck1, ck2, weights=None)[source]

Compute the cocktail distance coefficient between cocktails.

This function implements the cocktails distance coefficient defined as:

\[CD_{coeff}(i,j) = \frac{1}{sum(w)}\Biggl(\Bigl(\frac{\left|E(pH_{i})-E(pH_{j})\right|}{14}\Bigr)w_{1}+BC(F_{i},F_{j})w_{2}\Biggr)\]

Where \(w=\left\{w_{1},w_{2}\right\}\) are weights, \(w_{k} \ge 0\), \(sum(w) > 0\). \(F_{i}\) is the fingerprint of cocktail \(i\) and \(E(pH_{i})\) is n estimate of the pH in condition \(i\) normalized by a maxium pH of 14. \(BC(F_{i},F_{j})\) is the Bray-Curtis dissimilarity measure between cocktail fingerprints \(i\) and \(j\).

cockatoo.metric.fp_distance(ck1, ck2)[source]

Compute distance between fingerprint vectors

Parameters
  • ck1 (cocktail) – First cocktail to compare

  • ck2 (cocktail) – Second cocktail to compare

Returns

The distance score between 0 and 1, or None if either cocktail is missing a fingerprint

cockatoo.metric.ph_distance(ck1, ck2)[source]

Compute pH distance.

Parameters
  • ck1 (cocktail) – First cocktail to compare

  • ck2 (cocktail) – Second cocktail to compare

Returns

The distance score between 0 and 1 or None if cocktails are missing pH