public enum SparseDoubleFVComparison extends Enum<SparseDoubleFVComparison> implements FVComparator<SparseDoubleFV>
Enum Constant and Description |
---|
ARCCOS
The arccosine of the cosine similarity
|
BHATTACHARYYA
Bhattacharyya distance
d(H1,H2) = sqrt( 1 - (1 / sqrt(sumI(H1(I)) * sumI(H2(I))) ) * sumI( sqrt(H1(I) * H2(I)) ) )
|
CHI_SQUARE
Chi-squared distance
d(H1,H2) = 0.5 * sumI[(H1(I)-H2(I))^2 / (H1(I)+H2(I))]
|
CITY_BLOCK
City-block (L1) distance
d(H1,H2) = sumI( abs(H1(I)-H2(I)) )
|
CORRELATION
Correlation
d(H1,H2) = sumI( H'1(I) * H'2(I) ) / sqrt( sumI[H'1(I)2]^2 * sumI[H'2(I)^2] )
where
H'k(I) = Hk(I) - (1/N) * sumJ( Hk(J) ); N=number of FeatureVector bins
|
COSINE_DIST
Cosine distance (-COSINE_SIM)
|
COSINE_SIM
Cosine similarity (sim of 1 means identical)
d(H1,H2)=sumI(H1(I) * H2(I))) / (sumI(H1(I)^2) sumI(H2(I)^2))
|
EUCLIDEAN
Euclidean distance
d(H1,H2) = Math.sqrt( sumI( (H1(I)-H2(I))^2 ) )
|
HAMMING
Hamming Distance
d(H1,H2) = sumI(H1(I) == H2(I) ? 1 : 0)
|
INNER_PRODUCT
Inner product
d(H1,H2) =sumI(H1(I) * H2(I))
|
INTERSECTION
Histogram intersection; assumes all values > 0.
|
JACCARD_DISTANCE
Jaccard distance.
|
PACKED_HAMMING
Hamming Distance for packed bit strings
d(H1,H2) = sumI(H1(I) == H2(I) ? 1 : 0)
|
SYMMETRIC_KL_DIVERGENCE
The symmetric Kullback-Leibler divergence.
|
Modifier and Type | Method and Description |
---|---|
abstract double |
compare(SparseDoubleArray h1,
SparseDoubleArray h2)
Compare two feature vectors in the form of sparse arrays,
returning a score or distance.
|
double |
compare(SparseDoubleFV h1,
SparseDoubleFV h2)
Compare two objects, returning a score
or distance.
|
boolean |
isDistance() |
static SparseDoubleFVComparison |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SparseDoubleFVComparison[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SparseDoubleFVComparison EUCLIDEAN
public static final SparseDoubleFVComparison CORRELATION
public static final SparseDoubleFVComparison CHI_SQUARE
public static final SparseDoubleFVComparison INTERSECTION
public static final SparseDoubleFVComparison BHATTACHARYYA
public static final SparseDoubleFVComparison HAMMING
public static final SparseDoubleFVComparison PACKED_HAMMING
public static final SparseDoubleFVComparison CITY_BLOCK
public static final SparseDoubleFVComparison COSINE_SIM
public static final SparseDoubleFVComparison COSINE_DIST
public static final SparseDoubleFVComparison ARCCOS
public static final SparseDoubleFVComparison SYMMETRIC_KL_DIVERGENCE
public static final SparseDoubleFVComparison JACCARD_DISTANCE
public static final SparseDoubleFVComparison INNER_PRODUCT
public static SparseDoubleFVComparison[] values()
for (SparseDoubleFVComparison c : SparseDoubleFVComparison.values()) System.out.println(c);
public static SparseDoubleFVComparison valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic boolean isDistance()
isDistance
in interface DistanceComparator<SparseDoubleFV>
public double compare(SparseDoubleFV h1, SparseDoubleFV h2)
DistanceComparator
compare
in interface DistanceComparator<SparseDoubleFV>
h1
- the first objecth2
- the second objectpublic abstract double compare(SparseDoubleArray h1, SparseDoubleArray h2)
h1
- the first feature arrayh2
- the second feature array