@Shareable public class ItemVectorSimilarity extends java.lang.Object implements ItemSimilarity, java.io.Serializable, MaybeThreadSafe
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.
|
boolean |
isThreadSafe()
Query whether this object is thread-safe.
|
double |
similarity(long i1,
Long2DoubleMap v1,
long i2,
Long2DoubleMap v2)
Compute the similarity between two items.
|
java.lang.String |
toString() |
@Inject public ItemVectorSimilarity(VectorSimilarity sim)
public double similarity(long i1, Long2DoubleMap v1, long i2, Long2DoubleMap 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()
public boolean isThreadSafe()
MaybeThreadSafe
Query whether this object is thread-safe.
isThreadSafe
in interface MaybeThreadSafe
true
if the object is thread-safe.public java.lang.String toString()
toString
in class java.lang.Object