Module engram::metrics

source ·
Expand description

Metrics

Functions§

  • Compute the cosine similarity between two vectors. Formula: dot(a, b) / (|a| * |b|)
  • Compute the Jaccard index between two sets. Formula: |A ∩ B| / |A ∪ B|
  • Compute the L1 norm (Manhattan distance) of a vector.
  • Compute the L2 norm (Euclidean distance) of a vector.
  • Compute the L∞ (max) norm of a vector.
  • Calculate the Pearson correlation coefficient between two vectors. Formula:
  • Compute the Tanimoto Coefficient for continuous vectors. A measure of similarity for real-valued vectors that generalizes the Jaccard index. Formula: dot(a, b) / (|a|^2 + |b|^2 - dot(a, b))