Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CosineSimilarity ¶
CosineSimilarity calculates the cosine similarity between two vectors. The vectors must be of the same length.
func MaximalMarginalRelevance ¶
func MaximalMarginalRelevance( queryEmbedding *mat.Dense, embeddingList *mat.Dense, lambdaMult float64, k int, ) ([]int, error)
MaximalMarginalRelevance implements the Maximal Marginal Relevance algorithm. It takes a query embedding, a list of embeddings, a lambda multiplier, and a number of results to return. It returns a list of indices of the embeddings that are most relevant to the query. This is a relatively naive and unoptimized implementation of MMR. :-/ See https://www.cs.cmu.edu/~jgc/publication/The_Use_MMR_Diversity_Based_LTMIR_1998.pdf
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.