public class HellingerNormaliser extends Object implements Normaliser<FloatFV>
Normaliser
normalises vectors such that the Euclidean distance
between normalised vectors is equivalent to computing the similarity using
the Hellinger kernel on the un-normalised vectors.
The normalisation works by optionally adding an offset to the vectors (to deal with input vectors that have negative values), L1 normalising the vectors and finally performing an element-wise sqrt.
Modifier and Type | Field and Description |
---|---|
protected int |
offset |
Constructor and Description |
---|
HellingerNormaliser()
Construct with no offset
|
HellingerNormaliser(int offset)
Construct with the given offset
|
Modifier and Type | Method and Description |
---|---|
static void |
normalise(float[] values,
int offset)
Static utility function to perform Hellinger normalisation.
|
void |
normalise(FloatFV feature)
Normalise the feature in some way
|
protected int offset
public HellingerNormaliser()
public HellingerNormaliser(int offset)
offset
- the offsetpublic void normalise(FloatFV feature)
Normaliser
normalise
in interface Normaliser<FloatFV>
feature
- the feature to normalisepublic static void normalise(float[] values, int offset)
values
- the values to normaliseoffset
- the offset to add to the values before normalisation (to
ensure they are +ve).