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

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.PolynomialKernelFunction
All Implemented Interfaces:
DistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveDistanceFunction<NumberVector<?,?>,DoubleDistance>, PrimitiveSimilarityFunction<NumberVector<?,?>,DoubleDistance>, SimilarityFunction<NumberVector<?,?>,DoubleDistance>, InspectionUtilFrequentlyScanned, Parameterizable

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

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


Nested Class Summary
static class PolynomialKernelFunction.Parameterizer
          Parameterization class.
 
Field Summary
static double DEFAULT_DEGREE
          The default degree.
private  double degree
          Degree of the polynomial kernel function
static OptionID DEGREE_ID
          Degree parameter
 
Constructor Summary
PolynomialKernelFunction(double 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 the linear 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_DEGREE

public static final double DEFAULT_DEGREE
The default degree.

See Also:
Constant Field Values

DEGREE_ID

public static final OptionID DEGREE_ID
Degree parameter


degree

private double degree
Degree of the polynomial kernel function

Constructor Detail

PolynomialKernelFunction

public PolynomialKernelFunction(double degree)
Constructor.

Parameters:
degree - Kernel degree
Method Detail

similarity

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

Specified by:
similarity in interface PrimitiveSimilarityFunction<NumberVector<?,?>,DoubleDistance>
Parameters:
o1 - first vector
o2 - second vector
Returns:
the linear 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)