Attention: This MediaPipe Solutions Preview is an early release. Learn more.

CosineSimilarity

Stay organized with collections Save and categorize content based on your preferences.
public class CosineSimilarity

Utility class for computing cosine similarity between Embedding objects.

Public Methods

static double
compute(Embedding u, Embedding v)
Computes cosine similarity between two Embedding objects.

Inherited Methods

Public Methods

public static double compute (Embedding u, Embedding v)

Computes cosine similarity between two Embedding objects.

Parameters
u
v
Throws
IllegalArgumentException if the embeddings are of different types (float vs. quantized), have different sizes, or have an L2-norm of 0.