@Reference(authors="R. W. Hamming", title="Error detecting and error correcting codes", booktitle="Bell System technical journal, 29(2)", url="https://doi.org/10.1002/j.1538-7305.1950.tb00463.x", bibkey="doi:10.1002/j.1538-7305.1950.tb00463.x") public class HammingDistanceFunction extends AbstractSetDistanceFunction<FeatureVector<?>> implements NumberVectorDistanceFunction<FeatureVector<?>>
Reference:
R. W. Hamming
Error detecting and error correcting codes
Bell System technical journal, 29(2)
TODO: add a sparse (but not binary) optimized version?
Modifier and Type | Class and Description |
---|---|
static class |
HammingDistanceFunction.Parameterizer
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
static HammingDistanceFunction |
STATIC
Static instance.
|
DOUBLE_NULL, INTEGER_NULL, STRING_NULL
Constructor and Description |
---|
HammingDistanceFunction() |
Modifier and Type | Method and Description |
---|---|
double |
distance(FeatureVector<?> o1,
FeatureVector<?> o2)
Computes the distance between two given DatabaseObjects according to this
distance function.
|
double |
distance(NumberVector o1,
NumberVector o2)
Computes the distance between two given vectors according to this distance
function.
|
boolean |
equals(java.lang.Object obj) |
SimpleTypeInformation<? super FeatureVector<?>> |
getInputTypeRestriction()
Get the input data type of the function.
|
private double |
hammingDistanceNumberVector(NumberVector o1,
NumberVector o2)
Version for number vectors.
|
int |
hashCode() |
boolean |
isMetric()
Is this distance function metric (satisfy the triangle inequality)
|
isNull
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
instantiate
isSquared, isSymmetric
public static final HammingDistanceFunction STATIC
public boolean isMetric()
DistanceFunction
isMetric
in interface DistanceFunction<FeatureVector<?>>
true
when metric.public double distance(FeatureVector<?> o1, FeatureVector<?> o2)
PrimitiveDistanceFunction
distance
in interface PrimitiveDistanceFunction<FeatureVector<?>>
o1
- first DatabaseObjecto2
- second DatabaseObjectpublic double distance(NumberVector o1, NumberVector o2)
NumberVectorDistanceFunction
distance
in interface NumberVectorDistanceFunction<FeatureVector<?>>
o1
- first vectoro2
- second vectorprivate double hammingDistanceNumberVector(NumberVector o1, NumberVector o2)
o1
- First vectoro2
- Second vectorpublic SimpleTypeInformation<? super FeatureVector<?>> getInputTypeRestriction()
DistanceFunction
getInputTypeRestriction
in interface DistanceFunction<FeatureVector<?>>
getInputTypeRestriction
in interface PrimitiveDistanceFunction<FeatureVector<?>>
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © 2019 ELKI Development Team. License information.