@Shareable public class ItemVectorSimilarity extends Object implements ItemSimilarity, Serializable
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
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
isSparse
in interface ItemSimilarity
true
if the similarity function is sparse.VectorSimilarity.isSparse()
public boolean isSymmetric()
ItemSimilarity
isSymmetric
in interface ItemSimilarity
true
if the similarity function is symmetric.VectorSimilarity.isSymmetric()