|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.math.hadoop.similarity.vector.AbstractDistributedVectorSimilarity
public abstract class AbstractDistributedVectorSimilarity
abstract base implementation of DistributedVectorSimilarity
Constructor Summary | |
---|---|
AbstractDistributedVectorSimilarity()
|
Method Summary | |
---|---|
protected static int |
countElements(java.lang.Iterable<?> iterable)
computes the number of elements in the Iterable |
protected static int |
countElements(java.util.Iterator<?> iterator)
computes the number of elements in the Iterator |
protected abstract double |
doComputeResult(int rowA,
int rowB,
java.lang.Iterable<Cooccurrence> cooccurrences,
double weightOfVectorA,
double weightOfVectorB,
int numberOfColumns)
do the actual similarity computation |
double |
similarity(int rowA,
int rowB,
java.lang.Iterable<Cooccurrence> cooccurrences,
double weightOfVectorA,
double weightOfVectorB,
int numberOfColumns)
ensures that the computed similarity is in [-1,1] |
double |
weight(Vector v)
vectors have no weight (NaN) by default, subclasses may override this |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractDistributedVectorSimilarity()
Method Detail |
---|
public final double similarity(int rowA, int rowB, java.lang.Iterable<Cooccurrence> cooccurrences, double weightOfVectorA, double weightOfVectorB, int numberOfColumns)
similarity
in interface DistributedVectorSimilarity
rowA
- offset of the first rowrowB
- offset of the second rowcooccurrences
- all column entries where both vectors have a nonZero entryweightOfVectorA
- the result of DistributedVectorSimilarity.weight(Vector)
for the first row vectorweightOfVectorB
- the result of DistributedVectorSimilarity.weight(Vector)
for the first row vectorprotected static int countElements(java.lang.Iterable<?> iterable)
Iterable
protected static int countElements(java.util.Iterator<?> iterator)
Iterator
protected abstract double doComputeResult(int rowA, int rowB, java.lang.Iterable<Cooccurrence> cooccurrences, double weightOfVectorA, double weightOfVectorB, int numberOfColumns)
DistributedVectorSimilarity.similarity(int, int, Iterable, double, double, int)
public double weight(Vector v)
weight
in interface DistributedVectorSimilarity
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |