de.lmu.ifi.dbs.elki.distance.similarityfunction.kernel
Class FooKernelFunction

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
      extended by de.lmu.ifi.dbs.elki.distance.similarityfunction.kernel.FooKernelFunction
All Implemented Interfaces:
DistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveSimilarityFunction<NumberVector<?,?>,DoubleDistance>, SimilarityFunction<NumberVector<?,?>,DoubleDistance>, InspectionUtilFrequentlyScanned, Parameterizable

public class FooKernelFunction
extends AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
implements PrimitiveSimilarityFunction<NumberVector<?,?>,DoubleDistance>

Provides an experimental KernelDistanceFunction for NumberVectors. Currently only supports 2D data and x1^2 ~ x2 correlations.


Nested Class Summary
static class FooKernelFunction.Parameterizer
          Parameterization class.
 
Field Summary
static int DEFAULT_MAX_DEGREE
          The default max_degree.
private  int max_degree
          Degree of the polynomial kernel function
static OptionID MAX_DEGREE_ID
          Parameter for the maximum degree
 
Constructor Summary
FooKernelFunction(int max_degree)
          Constructor.
 
Method Summary
 DoubleDistance distance(NumberVector<?,?> fv1, NumberVector<?,?> fv2)
          Computes the distance between two given DatabaseObjects according to this distance function.
 DoubleDistance getDistanceFactory()
          Method to get the distance functions factory.
 VectorFieldTypeInformation<? super NumberVector<?,?>> getInputTypeRestriction()
          Get the input data type of the function.
<T extends NumberVector<?,?>>
DistanceSimilarityQuery<T,DoubleDistance>
instantiate(Relation<T> database)
          Instantiate with a database to get the actual distance query.
 DoubleDistance similarity(NumberVector<?,?> o1, NumberVector<?,?> o2)
          Provides an experimental kernel similarity between the given two vectors.
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPrimitiveDistanceFunction
isMetric, 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.similarityfunction.SimilarityFunction
isSymmetric
 

Field Detail

DEFAULT_MAX_DEGREE

public static final int DEFAULT_MAX_DEGREE
The default max_degree.

See Also:
Constant Field Values

MAX_DEGREE_ID

public static final OptionID MAX_DEGREE_ID
Parameter for the maximum degree


max_degree

private int max_degree
Degree of the polynomial kernel function

Constructor Detail

FooKernelFunction

public FooKernelFunction(int max_degree)
Constructor.

Parameters:
max_degree - Maximum degree-
Method Detail

similarity

public DoubleDistance similarity(NumberVector<?,?> o1,
                                 NumberVector<?,?> o2)
Provides an experimental kernel similarity between the given two vectors.

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

distance

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

Specified by:
distance in interface PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
Specified by:
distance in class AbstractPrimitiveDistanceFunction<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 NumberVector<?,?>> getInputTypeRestriction()
Description copied from interface: SimilarityFunction
Get the input data type of the function.

Specified by:
getInputTypeRestriction in interface DistanceFunction<NumberVector<?,?>,DoubleDistance>
Specified by:
getInputTypeRestriction in interface PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
Specified by:
getInputTypeRestriction in interface PrimitiveSimilarityFunction<NumberVector<?,?>,DoubleDistance>
Specified by:
getInputTypeRestriction in interface SimilarityFunction<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<NumberVector<?,?>,DoubleDistance>
Specified by:
getDistanceFactory in interface SimilarityFunction<NumberVector<?,?>,DoubleDistance>
Specified by:
getDistanceFactory in class AbstractPrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>
Returns:
Factory for distance objects

instantiate

public <T extends NumberVector<?,?>> DistanceSimilarityQuery<T,DoubleDistance> instantiate(Relation<T> database)
Description copied from class: AbstractPrimitiveDistanceFunction
Instantiate with a database to get the actual distance query.

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

Release 0.4.0 (2011-09-20_1324)