Class PolynomialKernel
java.lang.Object
com.imsl.datamining.supportvectormachine.Kernel
com.imsl.datamining.supportvectormachine.PolynomialKernel
- All Implemented Interfaces:
Cloneable
Specifies the polynomial kernel for support vector machines.
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 Summary
ConstructorsConstructorDescriptionConstructor for the polynomial kernel.PolynomialKernel(double gamma, double r, int degree) Constructs a polynomial kernel.PolynomialKernel(PolynomialKernel polyKernel) Constructs a copy of the inputPolynomialKernelkernel. -
Method Summary
Modifier and TypeMethodDescriptionclone()Clones aPolynomialKernelkernel.doublekernelFunction(DataNode[][] x, int i, int j) Calculates the kernel function between twoDataNodes.doublekernelFunction(DataNode[] x, DataNode[] y) Calculates the kernel function between twoDataNodes.voidsetParameters(double... kParams) Sets the parameters for the polynomial kernel.Methods inherited from class com.imsl.datamining.supportvectormachine.Kernel
dot, getParameters
-
Constructor Details
-
PolynomialKernel
public PolynomialKernel()Constructor for the polynomial kernel.The default values for the polynomial kernel are \(\gamma\)=1.0,
r=0.0, anddegree=1. -
PolynomialKernel
Constructs a copy of the inputPolynomialKernelkernel.- Parameters:
polyKernel- aPolynomialKernelkernel
-
PolynomialKernel
public PolynomialKernel(double gamma, double r, int degree) Constructs a polynomial kernel.- Parameters:
gamma- adouble, the polynomial kernel free parameterr- adouble, the soft margin cost function parameterdegree- adouble, the degree of the polynomial kernel
-
-
Method Details
-
clone
Clones aPolynomialKernelkernel. -
setParameters
public void setParameters(double... kParams) Sets the parameters for the polynomial kernel.- Overrides:
setParametersin classKernel- Parameters:
kParams- adoublearray of length 3 containing parameter values:kParams[0]=\(\gamma\),kParams[1]=r, andkParams[2]=d.Default:
kParams[0]=\(\gamma\)=1.0,kParams[1]=r=0, andkParams[2]=d=1.
-
kernelFunction
Calculates the kernel function between twoDataNodes.- Specified by:
kernelFunctionin classKernel- Parameters:
x- aDataNodearrayy- aDataNodearray- Returns:
- a
double, the kernel function evaluated atxandy
-
kernelFunction
Calculates the kernel function between twoDataNodes.- Specified by:
kernelFunctionin classKernel- Parameters:
x- aDataNodematrixi- anint, the index of the firstDataNode,x[i]j- anint, the index of the secondDataNode,x[j]- Returns:
- a
double, the kernel function evaluated atx[i]andx[j]
-