T - type of the tokenpublic final class EuclideanDistance<T> extends Object implements MultisetMetric<T>, MultisetDistance<T>
similarity(a,b) = 1 - distance(a,b) / √(∣a∣² + ∣b∣²)
distance(a,b) = ∣∣a - b∣∣
This class is immutable and thread-safe.
| Constructor and Description |
|---|
EuclideanDistance() |
| Modifier and Type | Method and Description |
|---|---|
float |
compare(com.google.common.collect.Multiset<T> a,
com.google.common.collect.Multiset<T> b)
Measures the similarity between multisets a and b.
|
float |
distance(com.google.common.collect.Multiset<T> a,
com.google.common.collect.Multiset<T> b)
Measures the distance between multisets a and b.
|
String |
toString() |
public float compare(com.google.common.collect.Multiset<T> a, com.google.common.collect.Multiset<T> b)
MultisetMetric
Results are undefined if a and b are based on different
equivalence relations (as HashMultiset and TreeMultiset
are).
public float distance(com.google.common.collect.Multiset<T> a, com.google.common.collect.Multiset<T> b)
MultisetDistance0.0 indicates that a
and b are similar.
Results are undefined if a and b are based on different
equivalence relations (as HashMultiset and TreeMultiset
are).
Copyright © 2014–2016. All rights reserved.