@Shareable public class ItemVectorSimilarity extends Object implements ItemSimilarity, Serializable
Implementation of ItemSimilarity
that delegates to a vector similarity.
Constructor and Description |
---|
ItemVectorSimilarity(VectorSimilarity sim) |
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 i1,
SparseVector v1,
long i2,
SparseVector v2)
Compute the similarity between two items.
|
String |
toString() |
@Inject public ItemVectorSimilarity(VectorSimilarity sim)
public double similarity(long i1, SparseVector v1, long i2, SparseVector v2)
ItemSimilarity
Compute the similarity between two items.
similarity
in interface ItemSimilarity
i1
- The first item ID.v1
- The first item vector.i2
- The second item ID.v2
- The second item vector.public boolean isSparse()
ItemSimilarity
Query whether this similarity is sparse.
isSparse
in interface ItemSimilarity
true
if the similarity function is sparse.VectorSimilarity.isSparse()
public boolean isSymmetric()
ItemSimilarity
Query whether this similarity is symmetric.
isSymmetric
in interface ItemSimilarity
true
if the similarity function is symmetric.VectorSimilarity.isSymmetric()