Method GetCosineSimilarity
- Namespace
- LMKit.Embeddings
- Assembly
- LM-Kit.NET.dll
GetCosineSimilarity(IList<float>, IList<float>)
Calculates the cosine similarity between two embedding vectors, representing the cosine of the angle between them in a multidimensional space.
public static float GetCosineSimilarity(IList<float> embeddings1, IList<float> embeddings2)
Parameters
embeddings1
IList<float>The first embedding vector.
embeddings2
IList<float>The second embedding vector.
Returns
- float
The cosine similarity value in the range [-1, 1]. A value closer to 1 indicates higher similarity.
Remarks
The higher the cosine similarity value, the closer the proximity of the two texts from which the embedding vectors have been computed.