public class PolynomialKernelFunction extends AbstractVectorDoubleSimilarityFunction implements PrimitiveDoubleDistanceFunction<NumberVector<?>>
Modifier and Type | Class and Description |
---|---|
static class |
PolynomialKernelFunction.Parameterizer
Parameterization class.
|
Modifier and Type | Field and 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 and Description |
---|
PolynomialKernelFunction(int degree)
Constructor.
|
PolynomialKernelFunction(int degree,
double bias)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
DoubleDistance |
distance(NumberVector<?> fv1,
NumberVector<?> fv2)
Computes the distance between two given DatabaseObjects according to this
distance function.
|
double |
doubleDistance(NumberVector<?> fv1,
NumberVector<?> fv2)
Computes the distance between two given Objects according to this distance
function.
|
double |
doubleSimilarity(NumberVector<?> o1,
NumberVector<?> o2)
Computes the similarity between two given Objects according to this
similarity function.
|
<T extends NumberVector<?>> |
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?)
|
getDistanceFactory, getInputTypeRestriction, similarity
isSymmetric
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInputTypeRestriction
getDistanceFactory, isSymmetric
isSymmetric
public static final int DEFAULT_DEGREE
private final int degree
private final double bias
public PolynomialKernelFunction(int degree, double bias)
degree
- Kernel degreebias
- Bias offsetpublic PolynomialKernelFunction(int degree)
degree
- Kernel degreepublic double doubleSimilarity(NumberVector<?> o1, NumberVector<?> o2)
PrimitiveDoubleSimilarityFunction
doubleSimilarity
in interface PrimitiveDoubleSimilarityFunction<NumberVector<?>>
o1
- first Objecto2
- second Objectpublic DoubleDistance distance(NumberVector<?> fv1, NumberVector<?> fv2)
PrimitiveDistanceFunction
distance
in interface PrimitiveDistanceFunction<NumberVector<?>,DoubleDistance>
fv1
- first DatabaseObjectfv2
- second DatabaseObjectpublic boolean isMetric()
DistanceFunction
isMetric
in interface DistanceFunction<NumberVector<?>,DoubleDistance>
true
when metric.public double doubleDistance(NumberVector<?> fv1, NumberVector<?> fv2)
PrimitiveDoubleDistanceFunction
doubleDistance
in interface PrimitiveDoubleDistanceFunction<NumberVector<?>>
fv1
- first Objectfv2
- second Objectpublic <T extends NumberVector<?>> DistanceSimilarityQuery<T,DoubleDistance> instantiate(Relation<T> database)
SimilarityFunction
instantiate
in interface DistanceFunction<NumberVector<?>,DoubleDistance>
instantiate
in interface SimilarityFunction<NumberVector<?>,DoubleDistance>
instantiate
in class AbstractPrimitiveSimilarityFunction<NumberVector<?>,DoubleDistance>
database
- Representation to use