Function er_compare_vectors
computes similarities of embedding vectors.
er_compare_vectors(embedding, metric = "cosine")
a numeric
matrix containing a text embedding.
a character
string specifying the type of similarity. One of c("cosine","arccos","pearson","spearman")
. Default is "cosine"
.
The function returns a matrix
containing the similarities of all pairs of embedding vectors. The matrix
has nrow(embedding)
rows and columns.
Wulff, D. U., Aeschbach, Hussain, Z., S., & Mata, R. (2024). embeddeR. In preparation.
if (FALSE) {
# compute similarity matrix
embedding <- compare_vectors(embedding)
}