Package dev.langchain4j.store.embedding
Class RelevanceScore
java.lang.Object
dev.langchain4j.store.embedding.RelevanceScore
Utility class for converting between cosine similarity and relevance score.
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
fromCosineSimilarity
(double cosineSimilarity) Converts cosine similarity into relevance score.
-
Method Details
-
fromCosineSimilarity
public static double fromCosineSimilarity(double cosineSimilarity) Converts cosine similarity into relevance score.- Parameters:
cosineSimilarity
- Cosine similarity in the range [-1..1] where -1 is not relevant and 1 is relevant.- Returns:
- Relevance score in the range [0..1] where 0 is not relevant and 1 is relevant.
-