Class BrayCurtisDistance
- java.lang.Object
-
- elki.distance.AbstractNumberVectorDistance
-
- elki.distance.BrayCurtisDistance
-
- All Implemented Interfaces:
Distance<NumberVector>
,NumberVectorDistance<NumberVector>
,PrimitiveDistance<NumberVector>
,SpatialPrimitiveDistance<NumberVector>
@Reference(authors="J. R. Bray, J. T. Curtis",title="An ordination of the upland forest communities of southern Wisconsin",booktitle="Ecological monographs 27.4",url="https://doi.org/10.2307/1942268",bibkey="doi:10.2307/1942268") @Reference(authors="T. S\u00f8rensen",title="A method of establishing groups of equal amplitude in plant sociology based on similarity of species and its application to analyses of the vegetation on Danish commons",booktitle="Kongelige Danske Videnskabernes Selskab, Biologiske Skrifter 5(4)",bibkey="journals/misc/Sorensen48") @Reference(authors="L. R. Dice",title="Measures of the Amount of Ecologic Association Between Species",booktitle="Ecology 26 (3)",url="https://doi.org/10.2307/1932409",bibkey="doi:10.2307/1932409") @Alias({"bray-curtis","braycurtis","sorensen","dice","sorensen-dice"}) public class BrayCurtisDistance extends AbstractNumberVectorDistance implements SpatialPrimitiveDistance<NumberVector>
Bray-Curtis distance function / Sørensen–Dice coefficient for continuous vector spaces (not only binary data).Reference:
J. R. Bray, J. T. Curtis
An ordination of the upland forest communities of southern Wisconsin
Ecological monographs 27.4Also:
T. Sørensen
A method of establishing groups of equal amplitude in plant sociology based on similarity of species and its application to analyses of the vegetation on Danish commons
Kongelige Danske Videnskabernes Selskab, Biologiske Skrifter 5(4)and:
L. R. Dice
Measures of the Amount of Ecologic Association Between Species
Ecology 26 (3)Note: we modified the usual definition of Bray-Curtis for use with negative values. In essence, this function is defined as:
ManhattanDistance(v1, v2) / (ManhattanNorm(v1) + ManhattanNorm(v2))
This obviously limits the usefulness of this distance function for cases where this kind of normalization is desired. In particular in low dimensional data it should be used with care.
TODO: add a version optimized for sparse vectors / binary data.
- Since:
- 0.6.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BrayCurtisDistance.Par
Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description static BrayCurtisDistance
STATIC_CONTINUOUS
Static instance.
-
Constructor Summary
Constructors Constructor Description BrayCurtisDistance()
Deprecated.UseSTATIC_CONTINUOUS
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.boolean
equals(java.lang.Object obj)
int
hashCode()
double
minDist(SpatialComparable mbr1, SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this distance 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, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.distance.Distance
isMetric, isSquared, isSymmetric
-
Methods inherited from interface elki.distance.PrimitiveDistance
getInputTypeRestriction
-
Methods inherited from interface elki.distance.SpatialPrimitiveDistance
instantiate
-
-
-
-
Field Detail
-
STATIC_CONTINUOUS
public static final BrayCurtisDistance STATIC_CONTINUOUS
Static instance.
-
-
Constructor Detail
-
BrayCurtisDistance
@Deprecated public BrayCurtisDistance()
Deprecated.UseSTATIC_CONTINUOUS
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
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-