de.lmu.ifi.dbs.elki.distance.similarityfunction.kernel
Class LinearKernelFunction<O extends NumberVector<?,?>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.distance.similarityfunction.AbstractPrimitiveSimilarityFunction<O,DoubleDistance>
      extended by de.lmu.ifi.dbs.elki.distance.similarityfunction.kernel.LinearKernelFunction<O>
Type Parameters:
O - vector type
All Implemented Interfaces:
DistanceFunction<O,DoubleDistance>, PrimitiveDistanceFunction<O,DoubleDistance>, PrimitiveSimilarityFunction<O,DoubleDistance>, SimilarityFunction<O,DoubleDistance>, InspectionUtilFrequentlyScanned, Parameterizable

public class LinearKernelFunction<O extends NumberVector<?,?>>
extends AbstractPrimitiveSimilarityFunction<O,DoubleDistance>
implements PrimitiveDistanceFunction<O,DoubleDistance>

Provides a linear Kernel function that computes a similarity between the two feature vectors V1 and V2 defined by V1^T*V2.


Constructor Summary
LinearKernelFunction()
          Provides a linear Kernel function that computes a similarity between the two vectors V1 and V2 defined by V1^T*V2.
 
Method Summary
 DoubleDistance distance(O fv1, O fv2)
          Computes the distance between two given DatabaseObjects according to this distance function.
 DoubleDistance getDistanceFactory()
          Method to get the distance functions factory.
 VectorFieldTypeInformation<? super O> getInputTypeRestriction()
          Get the input data type of the function.
<T extends O>
DistanceSimilarityQuery<T,DoubleDistance>
instantiate(Relation<T> database)
          Instantiate with a representation to get the actual similarity query.
 boolean isMetric()
          Is this distance function metric (in particular, does it satisfy the triangle equation?)
 DoubleDistance similarity(O o1, O o2)
          Provides a linear Kernel function that computes a similarity between the two feature vectors V1 and V2 definded by V1^T*V2
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.similarityfunction.AbstractPrimitiveSimilarityFunction
isSymmetric
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction
isSymmetric
 

Constructor Detail

LinearKernelFunction

public LinearKernelFunction()
Provides a linear Kernel function that computes a similarity between the two vectors V1 and V2 defined by V1^T*V2.

Method Detail

similarity

public DoubleDistance similarity(O o1,
                                 O o2)
Provides a linear Kernel function that computes a similarity between the two feature vectors V1 and V2 definded by V1^T*V2

Specified by:
similarity in interface PrimitiveSimilarityFunction<O extends NumberVector<?,?>,DoubleDistance>
Specified by:
similarity in class AbstractPrimitiveSimilarityFunction<O extends NumberVector<?,?>,DoubleDistance>
Parameters:
o1 - first feature vector
o2 - second feature vector
Returns:
the linear kernel similarity between the given two vectors as an instance of DoubleDistance.

distance

public DoubleDistance distance(O fv1,
                               O fv2)
Description copied from interface: PrimitiveDistanceFunction
Computes the distance between two given DatabaseObjects according to this distance function.

Specified by:
distance in interface PrimitiveDistanceFunction<O extends NumberVector<?,?>,DoubleDistance>
Parameters:
fv1 - first DatabaseObject
fv2 - second DatabaseObject
Returns:
the distance between two given DatabaseObjects according to this distance function

getInputTypeRestriction

public VectorFieldTypeInformation<? super O> getInputTypeRestriction()
Description copied from interface: SimilarityFunction
Get the input data type of the function.

Specified by:
getInputTypeRestriction in interface DistanceFunction<O extends NumberVector<?,?>,DoubleDistance>
Specified by:
getInputTypeRestriction in interface PrimitiveDistanceFunction<O extends NumberVector<?,?>,DoubleDistance>
Specified by:
getInputTypeRestriction in interface PrimitiveSimilarityFunction<O extends NumberVector<?,?>,DoubleDistance>
Specified by:
getInputTypeRestriction in interface SimilarityFunction<O extends NumberVector<?,?>,DoubleDistance>
Specified by:
getInputTypeRestriction in class AbstractPrimitiveSimilarityFunction<O extends NumberVector<?,?>,DoubleDistance>
Returns:
Type restriction

getDistanceFactory

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

Specified by:
getDistanceFactory in interface DistanceFunction<O extends NumberVector<?,?>,DoubleDistance>
Specified by:
getDistanceFactory in interface SimilarityFunction<O extends NumberVector<?,?>,DoubleDistance>
Returns:
Factory for distance objects

isMetric

public boolean isMetric()
Description copied from interface: DistanceFunction
Is this distance function metric (in particular, does it satisfy the triangle equation?)

Specified by:
isMetric in interface DistanceFunction<O extends NumberVector<?,?>,DoubleDistance>
Returns:
true when metric.

instantiate

public <T extends O> DistanceSimilarityQuery<T,DoubleDistance> instantiate(Relation<T> database)
Description copied from interface: SimilarityFunction
Instantiate with a representation to get the actual similarity query.

Specified by:
instantiate in interface DistanceFunction<O extends NumberVector<?,?>,DoubleDistance>
Specified by:
instantiate in interface SimilarityFunction<O extends NumberVector<?,?>,DoubleDistance>
Overrides:
instantiate in class AbstractPrimitiveSimilarityFunction<O extends NumberVector<?,?>,DoubleDistance>
Parameters:
database - Representation to use
Returns:
Actual distance query.

Release 0.4.0 (2011-09-20_1324)