public class VectorCosineSimilarity extends VectorSimilarity
data, dense, norm2Array, norm2Map
Constructor and Description |
---|
VectorCosineSimilarity(FastPreferenceData<?,?> data,
double alpha,
boolean dense)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected double |
sim(double product,
double norm2A,
double norm2B)
Calculates the similarity value.
|
similarElems, similarity
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
similarity
public VectorCosineSimilarity(FastPreferenceData<?,?> data, double alpha, boolean dense)
data
- preference dataalpha
- asymmetry of the similarity, set to 0.5 for symmetrydense
- true for array-based calculations, false to map-basedprotected double sim(double product, double norm2A, double norm2B)
VectorSimilarity
sim
in class VectorSimilarity
product
- value of the inner product of vectorsnorm2A
- square of the norm of the first vectornorm2B
- square of the norm of the second vectorCopyright © 2016. All rights reserved.