public class BinaryLongTversky extends Object implements UnguardedDissimilarityCalculator<long[]>, Serializable
long []
.
Dissimilarity is expressed as 1 - [COMMON] / [COMMON + q * QUERYONLY + t TARGETONLY]
Use with extreme care! This implementation wont check vector length equality.
Constructor and Description |
---|
BinaryLongTversky(double coeffQuery,
double coeffTarget)
Construct new instance.
|
Modifier and Type | Method and Description |
---|---|
double |
denormalize(double dissimilarity)
Calculate raw value for a normalized dissimilarity value.
|
double |
dissimilarity(long[] target,
long[] query)
Compare dissimilarity of two objects.
|
double |
normalize(double rawValue)
Normalize dissimilarity value returned by
UnguardedDissimilarityCalculator.dissimilarity(java.lang.Object, java.lang.Object) . |
String |
toString() |
public BinaryLongTversky(double coeffQuery, double coeffTarget)
coeffTarget
- Target side coefficientcoeffQuery
- Query side coefficientpublic double dissimilarity(long[] target, long[] query)
UnguardedDissimilarityCalculator
Note that implementations might not check even basic consistency of compared objects.
Implementations must return valid real numbers which are smaller than Double.MAX_VALUE
.
dissimilarity
in interface UnguardedDissimilarityCalculator<long[]>
target
- Target to comparequery
- Query to comparepublic double normalize(double rawValue)
UnguardedDissimilarityCalculator
UnguardedDissimilarityCalculator.dissimilarity(java.lang.Object, java.lang.Object)
.normalize
in interface UnguardedDissimilarityCalculator<long[]>
rawValue
- Raw dissimilarity valuepublic double denormalize(double dissimilarity)
UnguardedDissimilarityCalculator
denormalize
in interface UnguardedDissimilarityCalculator<long[]>
dissimilarity
- Normalized dissimilarity value