@DefaultImplementation(value=CosineVectorSimilarity.class) public interface VectorSimilarity
Modifier and Type | Method and Description |
---|---|
boolean |
isSparse()
Query whether this similarity function is sparse (returns 0 for vectors with
disjoint key sets).
|
boolean |
isSymmetric()
Query whether this similarity function is symmetric.
|
double |
similarity(SparseVector vec1,
SparseVector vec2)
Compute the similarity between two vectors.
|
double similarity(SparseVector vec1, SparseVector vec2)
vec1
- The left vector to compare.vec2
- The right vector to compare.boolean isSparse()
true
iff similarity(SparseVector, SparseVector)
will always return
true when applied to two vectors with no keys in common.boolean isSymmetric()
true
if the function is symmetric.