Package elki.similarity
Class Kulczynski1Similarity
- java.lang.Object
-
- elki.distance.AbstractNumberVectorDistance
-
- elki.similarity.Kulczynski1Similarity
-
- All Implemented Interfaces:
Distance<NumberVector>
,NumberVectorDistance<NumberVector>
,PrimitiveDistance<NumberVector>
,SpatialPrimitiveDistance<NumberVector>
,PrimitiveSimilarity<NumberVector>
,Similarity<NumberVector>
@Reference(authors="M.-M. Deza, E. Deza", title="Dictionary of distances", booktitle="Dictionary of distances", url="https://doi.org/10.1007/978-3-642-00234-2", bibkey="doi:10.1007/978-3-642-00234-2") public class Kulczynski1Similarity extends AbstractNumberVectorDistance implements SpatialPrimitiveDistance<NumberVector>, PrimitiveSimilarity<NumberVector>
Kulczynski similarity 1.\[ s_\text{Kulczynski-1}(\vec{x},\vec{y}):= \tfrac{\sum\nolimits_i\min\{x_i,y_i\}}{\sum\nolimits_i |x_i-y_i|} \] or in distance form: \[ d_\text{Kulczynski-1}(\vec{x},\vec{y}):= \tfrac{\sum\nolimits_i |x_i-y_i|}{\sum\nolimits_i\min\{x_i,y_i\}} \]
Reference:
M.-M. Deza and E. Deza
Dictionary of distances- Since:
- 0.6.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Kulczynski1Similarity.Par
Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description static Kulczynski1Similarity
STATIC
Static instance.
-
Constructor Summary
Constructors Constructor Description Kulczynski1Similarity()
Deprecated.UseSTATIC
instance instead.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
distance(NumberVector v1, NumberVector v2)
Computes the distance between two given DatabaseObjects according to this distance function.<T extends NumberVector>
SpatialPrimitiveDistanceSimilarityQuery<T>instantiate(Relation<T> database)
Instantiate with a database to get the actual distance query.boolean
isSymmetric()
Is this function symmetric?double
minDist(SpatialComparable mbr1, SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this distance function.double
similarity(NumberVector v1, NumberVector v2)
Computes the similarity between two given DatabaseObjects according to this similarity function.-
Methods inherited from class elki.distance.AbstractNumberVectorDistance
dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, getInputTypeRestriction
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.distance.PrimitiveDistance
getInputTypeRestriction
-
Methods inherited from interface elki.similarity.Similarity
getInputTypeRestriction
-
-
-
-
Field Detail
-
STATIC
public static final Kulczynski1Similarity STATIC
Static instance.
-
-
Constructor Detail
-
Kulczynski1Similarity
@Deprecated public Kulczynski1Similarity()
Deprecated.UseSTATIC
instance instead.Constructor.
-
-
Method Detail
-
distance
public double distance(NumberVector v1, NumberVector v2)
Description copied from interface:PrimitiveDistance
Computes the distance between two given DatabaseObjects according to this distance function.- Specified by:
distance
in interfaceNumberVectorDistance<NumberVector>
- Specified by:
distance
in interfacePrimitiveDistance<NumberVector>
- Parameters:
v1
- first DatabaseObjectv2
- second DatabaseObject- Returns:
- the distance between two given DatabaseObjects according to this distance function
-
minDist
public double minDist(SpatialComparable mbr1, SpatialComparable mbr2)
Description copied from interface:SpatialPrimitiveDistance
Computes the distance between the two given MBRs according to this distance function.- Specified by:
minDist
in interfaceSpatialPrimitiveDistance<NumberVector>
- Parameters:
mbr1
- the first MBR objectmbr2
- the second MBR object- Returns:
- the distance between the two given MBRs according to this distance function
-
similarity
public double similarity(NumberVector v1, NumberVector v2)
Description copied from interface:PrimitiveSimilarity
Computes the similarity between two given DatabaseObjects according to this similarity function.- Specified by:
similarity
in interfacePrimitiveSimilarity<NumberVector>
- Parameters:
v1
- first DatabaseObjectv2
- second DatabaseObject- Returns:
- the similarity between two given DatabaseObjects according to this similarity function
-
isSymmetric
public boolean isSymmetric()
Description copied from interface:Distance
Is this function symmetric?- Specified by:
isSymmetric
in interfaceDistance<NumberVector>
- Specified by:
isSymmetric
in interfaceSimilarity<NumberVector>
- Returns:
true
when symmetric
-
instantiate
public <T extends NumberVector> SpatialPrimitiveDistanceSimilarityQuery<T> instantiate(Relation<T> database)
Description copied from interface:Distance
Instantiate with a database to get the actual distance query.- Specified by:
instantiate
in interfaceDistance<NumberVector>
- Specified by:
instantiate
in interfacePrimitiveDistance<NumberVector>
- Specified by:
instantiate
in interfacePrimitiveSimilarity<NumberVector>
- Specified by:
instantiate
in interfaceSimilarity<NumberVector>
- Specified by:
instantiate
in interfaceSpatialPrimitiveDistance<NumberVector>
- Parameters:
database
- The representation to use- Returns:
- Actual distance query.
-
-