edu.stanford.nlp.linalg
Class AbstractMetric

java.lang.Object
  |
  +--edu.stanford.nlp.linalg.AbstractMetric
All Implemented Interfaces:
Metric, Similarity
Direct Known Subclasses:
L1, L2

public abstract class AbstractMetric
extends Object
implements Metric, Similarity

Class which defines distance and similarity functions once we have a norm


Constructor Summary
AbstractMetric()
           
 
Method Summary
 double distance(Array i, Array j)
          returns the distance between i and j according to the metric defined in this class
abstract  double norm(Array i)
          returns the norm of a vector in this metric
 Array normalize(Array i)
          normalizes vector i to have length 1 in the norm defined in this class
 double similarity(Array i, Array j)
          returns the similarity of document i and j according to the similarity measure defined in this class, which is 2-distance(i,j)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMetric

public AbstractMetric()
Method Detail

norm

public abstract double norm(Array i)
returns the norm of a vector in this metric

Specified by:
norm in interface Metric

distance

public double distance(Array i,
                       Array j)
returns the distance between i and j according to the metric defined in this class

Specified by:
distance in interface Metric

similarity

public double similarity(Array i,
                         Array j)
returns the similarity of document i and j according to the similarity measure defined in this class, which is 2-distance(i,j)

Specified by:
similarity in interface Similarity

normalize

public Array normalize(Array i)
normalizes vector i to have length 1 in the norm defined in this class

Specified by:
normalize in interface Metric


Stanford NLP Group