public class CosineDistanceFunction extends AbstractVectorDoubleDistanceFunction implements SpatialPrimitiveDoubleDistanceFunction<NumberVector<?>>
1-(cosine similarity)
.Modifier and Type | Class and Description |
---|---|
static class |
CosineDistanceFunction.Parameterizer
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
static CosineDistanceFunction |
STATIC
Static instance
|
Constructor and Description |
---|
CosineDistanceFunction()
Deprecated.
Use static instance
|
Modifier and Type | Method and Description |
---|---|
double |
doubleDistance(NumberVector<?> v1,
NumberVector<?> v2)
Computes the cosine distance for two given feature vectors.
|
double |
doubleMinDist(SpatialComparable mbr1,
SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this
distance function.
|
boolean |
equals(Object obj) |
SimpleTypeInformation<? super NumberVector<?>> |
getInputTypeRestriction()
Get the input data type of the function.
|
<T extends NumberVector<?>> |
instantiate(Relation<T> relation)
Instantiate with a database to get the actual distance query.
|
DoubleDistance |
minDist(SpatialComparable mbr1,
SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this distance
function.
|
String |
toString() |
distance, getDistanceFactory
isMetric, isSymmetric
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
distance
getDistanceFactory, isMetric, isSymmetric
public static final CosineDistanceFunction STATIC
@Deprecated public CosineDistanceFunction()
public double doubleDistance(NumberVector<?> v1, NumberVector<?> v2)
1-(cosine similarity)
.doubleDistance
in interface PrimitiveDoubleDistanceFunction<NumberVector<?>>
v1
- first feature vectorv2
- second feature vectorpublic double doubleMinDist(SpatialComparable mbr1, SpatialComparable mbr2)
SpatialPrimitiveDoubleDistanceFunction
doubleMinDist
in interface SpatialPrimitiveDoubleDistanceFunction<NumberVector<?>>
mbr1
- the first MBR objectmbr2
- the second MBR objectpublic DoubleDistance minDist(SpatialComparable mbr1, SpatialComparable mbr2)
SpatialPrimitiveDistanceFunction
minDist
in interface SpatialPrimitiveDistanceFunction<NumberVector<?>,DoubleDistance>
mbr1
- the first MBR objectmbr2
- the second MBR objectpublic <T extends NumberVector<?>> SpatialDistanceQuery<T,DoubleDistance> instantiate(Relation<T> relation)
AbstractPrimitiveDistanceFunction
instantiate
in interface DistanceFunction<NumberVector<?>,DoubleDistance>
instantiate
in interface SpatialPrimitiveDistanceFunction<NumberVector<?>,DoubleDistance>
instantiate
in class AbstractPrimitiveDistanceFunction<NumberVector<?>,DoubleDistance>
relation
- Representationpublic SimpleTypeInformation<? super NumberVector<?>> getInputTypeRestriction()
DistanceFunction
getInputTypeRestriction
in interface DistanceFunction<NumberVector<?>,DoubleDistance>
getInputTypeRestriction
in interface PrimitiveDistanceFunction<NumberVector<?>,DoubleDistance>
getInputTypeRestriction
in class AbstractVectorDoubleDistanceFunction