public class PolynomialKernel extends Kernel
The kernel function at two data nodes, \(x_i\) and \(x_j\), is given by \(K(x_i , x_j) = (\gamma x_i^Tx_j + r)^d\), where \(\gamma \gt 0\), \(r\), and \(d > 0 \) are configurable parameters.
Constructor and Description |
---|
PolynomialKernel()
Constructor for the polynomial kernel.
|
PolynomialKernel(double gamma,
double r,
int degree)
Constructs a polynomial kernel.
|
PolynomialKernel(PolynomialKernel polyKernel)
Constructs a copy of the input
PolynomialKernel kernel. |
Modifier and Type | Method and Description |
---|---|
PolynomialKernel |
clone()
Clones a
PolynomialKernel kernel. |
double |
kernelFunction(DataNode[][] x,
int i,
int j)
Calculates the kernel function between two
DataNode s. |
double |
kernelFunction(DataNode[] x,
DataNode[] y)
Calculates the kernel function between two
DataNode s. |
void |
setParameters(double... kParams)
Sets the parameters for the polynomial kernel.
|
dot, getParameters
public PolynomialKernel()
The default values for the polynomial kernel are
\(\gamma\)=1.0, r
=0.0, and
degree
=1.
public PolynomialKernel(PolynomialKernel polyKernel)
PolynomialKernel
kernel.polyKernel
- a PolynomialKernel
kernelpublic PolynomialKernel(double gamma, double r, int degree)
gamma
- a double
, the polynomial kernel free
parameterr
- a double
, the soft margin cost function
parameterdegree
- a double
, the degree of the polynomial kernelpublic PolynomialKernel clone()
PolynomialKernel
kernel.public void setParameters(double... kParams)
setParameters
in class Kernel
kParams
- a double
array of length 3 containing
parameter values: kParams[0]
=\(\gamma\),
kParams[1]
=r, and
kParams[2]
=d.
Default: kParams[0]
=\(\gamma\)=1.0,
kParams[1]
=r=0, and
kParams[2]
=d=1.
public double kernelFunction(DataNode[] x, DataNode[] y)
DataNode
s.kernelFunction
in class Kernel
x
- a DataNode
arrayy
- a DataNode
arraydouble
, the kernel function evaluated at
x
and y
public double kernelFunction(DataNode[][] x, int i, int j)
DataNode
s.kernelFunction
in class Kernel
x
- a DataNode
matrixi
- an int
, the index of the first DataNode
,
x[i]
j
- an int
, the index of the second DataNode
,
x[j]
double
, the kernel function evaluated at
x[i]
and x[j]
Copyright © 2020 Rogue Wave Software. All rights reserved.