de.lmu.ifi.dbs.elki.distance.distancefunction
Class CosineDistanceFunction

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
      extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractVectorDoubleDistanceFunction
          extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractCosineDistanceFunction
              extended by de.lmu.ifi.dbs.elki.distance.distancefunction.CosineDistanceFunction
All Implemented Interfaces:
DistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDoubleDistanceFunction<NumberVector<?,?>>, InspectionUtilFrequentlyScanned, Parameterizable

public class CosineDistanceFunction
extends AbstractCosineDistanceFunction

Cosine distance function for feature vectors. The cosine distance is computed from the cosine similarity by 1-(cosine similarity).


Nested Class Summary
static class CosineDistanceFunction.Parameterizer
          Parameterization class.
 
Field Summary
static CosineDistanceFunction STATIC
          Static instance
 
Constructor Summary
CosineDistanceFunction()
          Deprecated. Use static instance
 
Method Summary
 double doubleDistance(NumberVector<?,?> v1, NumberVector<?,?> v2)
          Computes the cosine distance for two given feature vectors.
 boolean equals(Object obj)
           
 String toString()
           
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractCosineDistanceFunction
angle, angleSparse, instantiate
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractVectorDoubleDistanceFunction
distance, getDistanceFactory, getInputTypeRestriction
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction
isMetric, isSymmetric
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction
isMetric, isSymmetric
 

Field Detail

STATIC

public static final CosineDistanceFunction STATIC
Static instance

Constructor Detail

CosineDistanceFunction

@Deprecated
public CosineDistanceFunction()
Deprecated. Use static instance

Provides a CosineDistanceFunction.

Method Detail

doubleDistance

public double doubleDistance(NumberVector<?,?> v1,
                             NumberVector<?,?> v2)
Computes the cosine distance for two given feature vectors. The cosine distance is computed from the cosine similarity by 1-(cosine similarity).

Parameters:
v1 - first feature vector
v2 - second feature vector
Returns:
the cosine distance for two given feature vectors v1 and v2

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

Release 0.4.0 (2011-09-20_1324)