@Shareable public class SignificanceWeightedVectorSimilarity extends Object implements VectorSimilarity, Serializable
SigWeightThreshold parameter.
Significance weighting decreases the similarity between two vectors when the number of common entities between the two vectors is low. For a threshold \(S\) and key sets \(K_1\) and \(K_2\), the similarity is multipled by \[\frac{|K_1 \cap K_2|}{\mathrm{max}(|K_1 \cap K_2|, S)}\]
SigWeightThreshold,
Serialized Form| Constructor and Description |
|---|
SignificanceWeightedVectorSimilarity(int thresh,
VectorSimilarity sim) |
| Modifier and Type | Method and Description |
|---|---|
VectorSimilarity |
getDelegate()
Get the underlying similarity (for debuggin purposes).
|
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(SparseVector vec1,
SparseVector vec2)
Compute the similarity between two vectors.
|
String |
toString() |
@Inject public SignificanceWeightedVectorSimilarity(@SigWeightThreshold int thresh, VectorSimilarity sim)
public VectorSimilarity getDelegate()
public double similarity(SparseVector vec1, SparseVector vec2)
VectorSimilaritysimilarity in interface VectorSimilarityvec1 - The left vector to compare.vec2 - The right vector to compare.public boolean isSparse()
VectorSimilarityisSparse in interface VectorSimilaritytrue iff VectorSimilarity.similarity(SparseVector, SparseVector) will always return
true when applied to two vectors with no keys in common.public boolean isSymmetric()
VectorSimilarityisSymmetric in interface VectorSimilaritytrue if the function is symmetric.