@DefaultImplementation(value=UserVectorSimilarity.class) public interface UserSimilarity
Compute the similarity between two users.
Modifier and Type | Method and Description |
---|---|
boolean |
isSparse()
Query whether this similarity is sparse.
|
boolean |
isSymmetric()
Query whether this similarity is symmetric.
|
double |
similarity(long u1,
Long2DoubleMap v1,
long u2,
Long2DoubleMap v2)
Compute the similarity between two users.
|
double similarity(long u1, Long2DoubleMap v1, long u2, Long2DoubleMap v2)
Compute the similarity between two users.
u1
- The first user ID.v1
- The first user vector.u2
- The second user ID.v2
- The second user vector.boolean isSparse()
Query whether this similarity is sparse.
true
if the similarity function is sparse.VectorSimilarity.isSparse()
boolean isSymmetric()
Query whether this similarity is symmetric.
Warning: At present, asymmetric similarity functions may not produce correct results. In practice, this is not a problem, as most similarity functions are symmetric. Watch issue 151 for updates on this issue.
true
if the similarity function is symmetric.VectorSimilarity.isSymmetric()