public interface SimilarityFunction
Vectors
. Methods
should provide efficient support for sparse vectors if an implementation is
feasible as these metrics are heavily used in some algorithms.
Metrics should note via isSymmetric()
whether or not they are
symmetic, whereby method.sim(A,B) == method.sim(B,A)
always
holds true for any A,B
. If the metric takes in any parameters,
such as weights, they can use the setParams(double...)
method, which can take
in any number of double
arguments. Methods should also provide a no
argument constructor that has reasonable default values, or loads values from
system properties.Modifier and Type | Method and Description |
---|---|
boolean |
isSymmetric()
Returns true if
sim(A,B) == sim(B,A) is true for any A ,
B . |
void |
setParams(double... arguments)
Sets an double parameters, such as weights, for this
SimilarityFunction . |
double |
sim(DoubleVector v1,
DoubleVector v2)
Returns the similarity between
v1 and v2 . |
double |
sim(IntegerVector v1,
IntegerVector v2)
Returns the similarity between
v1 and v2 . |
double |
sim(Vector v1,
Vector v2)
Returns the similarity between
v1 and v2 . |
void setParams(double... arguments)
SimilarityFunction
.boolean isSymmetric()
sim(A,B) == sim(B,A)
is true for any A
,
B
.double sim(DoubleVector v1, DoubleVector v2)
double sim(IntegerVector v1, IntegerVector v2)
Copyright © 2012. All Rights Reserved.