cc.mallet.types
Class NormalizedDotProductMetric

java.lang.Object
  extended by cc.mallet.types.NormalizedDotProductMetric
All Implemented Interfaces:
CachedMetric, Metric

public class NormalizedDotProductMetric
extends java.lang.Object
implements CachedMetric

Computes 1 - [ / sqrt (*)] aka 1 - cosine similarity


Constructor Summary
NormalizedDotProductMetric()
           
 
Method Summary
 double distance(SparseVector a, int hashCodeA, SparseVector b, int hashCodeB)
           
 double distance(SparseVector a, SparseVector b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NormalizedDotProductMetric

public NormalizedDotProductMetric()
Method Detail

distance

public double distance(SparseVector a,
                       SparseVector b)
Specified by:
distance in interface Metric

distance

public double distance(SparseVector a,
                       int hashCodeA,
                       SparseVector b,
                       int hashCodeB)
Specified by:
distance in interface CachedMetric