de.lmu.ifi.dbs.elki.distance.distancefunction.adapter
Class AbstractSimilarityAdapter<O>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractDatabaseDistanceFunction<O,DoubleDistance>
      extended by de.lmu.ifi.dbs.elki.distance.distancefunction.adapter.AbstractSimilarityAdapter<O>
Type Parameters:
O - object class to process
All Implemented Interfaces:
DistanceFunction<O,DoubleDistance>, InspectionUtilFrequentlyScanned, Parameterizable
Direct Known Subclasses:
SimilarityAdapterArccos, SimilarityAdapterLinear, SimilarityAdapterLn

public abstract class AbstractSimilarityAdapter<O>
extends AbstractDatabaseDistanceFunction<O,DoubleDistance>

Adapter from a normalized similarity function to a distance function. Note: The derived distance function will usually not satisfy the triangle equation.


Nested Class Summary
static class AbstractSimilarityAdapter.Instance<O>
          Inner proxy class for SNN distance function.
static class AbstractSimilarityAdapter.Parameterizer<O>
          Parameterization class.
 
Field Summary
static OptionID SIMILARITY_FUNCTION_ID
          Parameter to specify the similarity function to derive the distance between database objects from.
protected  NormalizedSimilarityFunction<? super O,? extends NumberDistance<?,?>> similarityFunction
          Holds the similarity function.
 
Constructor Summary
AbstractSimilarityAdapter(NormalizedSimilarityFunction<? super O,? extends NumberDistance<?,?>> similarityFunction)
          Constructor.
 
Method Summary
 boolean equals(Object obj)
           
 DoubleDistance getDistanceFactory()
          Method to get the distance functions factory.
 TypeInformation getInputTypeRestriction()
          Get the input data type of the function.
abstract
<T extends O>
DistanceQuery<T,DoubleDistance>
instantiate(Relation<T> database)
          Instantiate with a database to get the actual distance query.
 boolean isSymmetric()
          Is this function symmetric?
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractDatabaseDistanceFunction
isMetric
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIMILARITY_FUNCTION_ID

public static final OptionID SIMILARITY_FUNCTION_ID
Parameter to specify the similarity function to derive the distance between database objects from. Must extend NormalizedSimilarityFunction .

Key: -adapter.similarityfunction

Default value: FractionalSharedNearestNeighborSimilarityFunction


similarityFunction

protected NormalizedSimilarityFunction<? super O,? extends NumberDistance<?,?>> similarityFunction
Holds the similarity function.

Constructor Detail

AbstractSimilarityAdapter

public AbstractSimilarityAdapter(NormalizedSimilarityFunction<? super O,? extends NumberDistance<?,?>> similarityFunction)
Constructor.

Parameters:
similarityFunction - Similarity function to use.
Method Detail

getInputTypeRestriction

public TypeInformation getInputTypeRestriction()
Description copied from interface: DistanceFunction
Get the input data type of the function.

Returns:
Type restriction

isSymmetric

public boolean isSymmetric()
Description copied from interface: DistanceFunction
Is this function symmetric?

Specified by:
isSymmetric in interface DistanceFunction<O,DoubleDistance>
Overrides:
isSymmetric in class AbstractDatabaseDistanceFunction<O,DoubleDistance>
Returns:
true when symmetric

getDistanceFactory

public DoubleDistance getDistanceFactory()
Description copied from interface: DistanceFunction
Method to get the distance functions factory.

Specified by:
getDistanceFactory in interface DistanceFunction<O,DoubleDistance>
Specified by:
getDistanceFactory in class AbstractDatabaseDistanceFunction<O,DoubleDistance>
Returns:
Factory for distance objects

instantiate

public abstract <T extends O> DistanceQuery<T,DoubleDistance> instantiate(Relation<T> database)
Description copied from interface: DistanceFunction
Instantiate with a database to get the actual distance query.

Parameters:
database - The representation to use
Returns:
Actual distance query.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

Release 0.4.0 (2011-09-20_1324)