org.lenskit.similarity

Interface VectorSimilarity

• Method Summary

All Methods
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(Long2DoubleMap vec1, Long2DoubleMap vec2)
Compute the similarity between two vectors.
• Method Detail

• similarity

double similarity(Long2DoubleMap vec1,
Long2DoubleMap vec2)

Compute the similarity between two vectors.

Parameters:
vec1 - The left vector to compare.
vec2 - The right vector to compare.
Returns:
The similarity, in the range [-1,1].
• isSparse

boolean isSparse()

Query whether this similarity function is sparse (returns 0 for vectors with disjoint key sets).

Returns:
true iff similarity(Long2DoubleMap, Long2DoubleMap) will always return true when applied to two vectors with no keys in common.
• isSymmetric

boolean isSymmetric()

Query whether this similarity function is symmetric. Symmetric similarity functions return the same result when called on (A,B) and (B,A).

Returns:
true if the function is symmetric.