## Class PolynomialKernel

• All Implemented Interfaces:
Distance<NumberVector>, PrimitiveDistance<NumberVector>, PrimitiveSimilarity<NumberVector>, Similarity<NumberVector>
Direct Known Subclasses:
LinearKernel

public class PolynomialKernel
extends AbstractVectorSimilarity
implements PrimitiveDistance<NumberVector>
Polynomial Kernel function that computes a similarity between the two feature vectors x and y defined by $$(x^T\cdot y+b)^{\text{degree}}$$.
Since:
0.1
Author:
• ### Nested Class Summary

Nested Classes
Modifier and Type Class Description
static class  PolynomialKernel.Par
Parameterization class.
• ### Field Summary

Fields
Modifier and Type Field Description
private double bias
Bias of the similarity function.
static int DEFAULT_DEGREE
The default degree.
private int degree
Degree of the polynomial kernel function.
• ### Constructor Summary

Constructors
Constructor Description
PolynomialKernel​(int degree)
Constructor.
PolynomialKernel​(int degree, double bias)
Constructor.
• ### Method Summary

All Methods
Modifier and Type Method Description
double distance​(NumberVector fv1, NumberVector fv2)
Computes the distance between two given DatabaseObjects according to this distance function.
<T extends NumberVector>DistanceSimilarityQuery<T> instantiate​(Relation<T> database)
Instantiate with a database to get the actual distance query.
boolean isMetric()
Is this distance function metric (satisfy the triangle inequality)
boolean isSymmetric()
Is this function symmetric?
double similarity​(NumberVector o1, NumberVector o2)
Computes the similarity between two given DatabaseObjects according to this similarity function.
• ### Methods inherited from class elki.similarity.AbstractVectorSimilarity

getInputTypeRestriction
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Methods inherited from interface elki.distance.Distance

isSquared
• ### Methods inherited from interface elki.distance.PrimitiveDistance

getInputTypeRestriction
• ### Field Detail

• #### DEFAULT_DEGREE

public static final int DEFAULT_DEGREE
The default degree.
Constant Field Values
• #### degree

private final int degree
Degree of the polynomial kernel function.
• #### bias

private final double bias
Bias of the similarity function.
• ### Constructor Detail

• #### PolynomialKernel

public PolynomialKernel​(int degree,
double bias)
Constructor.
Parameters:
degree - Kernel degree
bias - Bias offset
• #### PolynomialKernel

public PolynomialKernel​(int degree)
Constructor.
Parameters:
degree - Kernel degree
• ### Method Detail

• #### similarity

public double similarity​(NumberVector o1,
NumberVector o2)
Description copied from interface: PrimitiveSimilarity
Computes the similarity between two given DatabaseObjects according to this similarity function.
Specified by:
similarity in interface PrimitiveSimilarity<NumberVector>
Parameters:
o1 - first DatabaseObject
o2 - second DatabaseObject
Returns:
the similarity between two given DatabaseObjects according to this similarity function
• #### isSymmetric

public boolean isSymmetric()
Description copied from interface: Distance
Is this function symmetric?
Specified by:
isSymmetric in interface Distance<NumberVector>
Specified by:
isSymmetric in interface Similarity<NumberVector>
Returns:
true when symmetric
• #### isMetric

public boolean isMetric()
Description copied from interface: Distance
Is this distance function metric (satisfy the triangle inequality)
Specified by:
isMetric in interface Distance<NumberVector>
Returns:
true when metric.
• #### distance

public double distance​(NumberVector fv1,
NumberVector fv2)
Description copied from interface: PrimitiveDistance
Computes the distance between two given DatabaseObjects according to this distance function.
Specified by:
distance in interface PrimitiveDistance<NumberVector>
Parameters:
fv1 - first DatabaseObject
fv2 - second DatabaseObject
Returns:
the distance between two given DatabaseObjects according to this distance function
• #### instantiate

public <T extends NumberVector> DistanceSimilarityQuery<T> instantiate​(Relation<T> database)
Description copied from interface: Distance
Instantiate with a database to get the actual distance query.
Specified by:
instantiate in interface Distance<NumberVector>
Specified by:
instantiate in interface PrimitiveDistance<NumberVector>
Specified by:
instantiate in interface PrimitiveSimilarity<NumberVector>
Specified by:
instantiate in interface Similarity<NumberVector>
Parameters:
database - The representation to use
Returns:
Actual distance query.