Package elki.similarity
Class InvertedDistanceSimilarity<O>
- java.lang.Object
-
- elki.similarity.InvertedDistanceSimilarity<O>
-
- Type Parameters:
O
- Object type
- All Implemented Interfaces:
PrimitiveSimilarity<O>
,Similarity<O>
public class InvertedDistanceSimilarity<O> extends java.lang.Object implements PrimitiveSimilarity<O>
Adapter to use a primitive number-distance as similarity measure, by computing 1/distance.- Since:
- 0.5.0
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description static OptionID
DISTANCE_FUNCTION_ID
Parameter to specify the similarity function to derive the distance between database objects from.protected PrimitiveDistance<? super O>
distanceFunction
Holds the similarity function.
-
Constructor Summary
Constructors Constructor Description InvertedDistanceSimilarity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpleTypeInformation<? super O>
getInputTypeRestriction()
Get the input data type of the function.double
similarity(O o1, O o2)
Computes the similarity between two given DatabaseObjects according to this similarity function.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.similarity.PrimitiveSimilarity
instantiate
-
Methods inherited from interface elki.similarity.Similarity
isSymmetric
-
-
-
-
Field Detail
-
DISTANCE_FUNCTION_ID
public static final OptionID DISTANCE_FUNCTION_ID
Parameter to specify the similarity function to derive the distance between database objects from. Must extendDistance
.
-
distanceFunction
protected PrimitiveDistance<? super O> distanceFunction
Holds the similarity function.
-
-
Method Detail
-
getInputTypeRestriction
public SimpleTypeInformation<? super O> getInputTypeRestriction()
Description copied from interface:Similarity
Get the input data type of the function.- Specified by:
getInputTypeRestriction
in interfaceSimilarity<O>
-
similarity
public double similarity(O o1, O o2)
Description copied from interface:PrimitiveSimilarity
Computes the similarity between two given DatabaseObjects according to this similarity function.- Specified by:
similarity
in interfacePrimitiveSimilarity<O>
- Parameters:
o1
- first DatabaseObjecto2
- second DatabaseObject- Returns:
- the similarity between two given DatabaseObjects according to this similarity function
-
-