jsat.distributions.kernels
Class PolynomialKernel
- java.lang.Object
-
- jsat.distributions.kernels.BaseKernelTrick
-
- jsat.distributions.kernels.PolynomialKernel
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, KernelTrick, Parameterized
public class PolynomialKernel extends BaseKernelTrick
Provides a Polynomial Kernel of the form
k(x,y) = (alpha * x.y + c)^d- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description PolynomialKernel(double degree)Defaults alpha = 1 and c = 1PolynomialKernel(double degree, double alpha, double c)Creates a new polynomial kernel
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description PolynomialKernelclone()doubleeval(Vec a, Vec b)Evaluate this kernel function for the two given vectors.doublegetAlpha()Returns the scaling parameterdoublegetC()Returns the additive constantdoublegetDegree()Returns the degree of the polynomialstatic DistributionguessDegree(DataSet d)Guesses the distribution to use for the degree parametervoidsetAlpha(double alpha)Sets the scaling factor for the dot product, this is equivalent to multiplying each value in the data set by a constant factorvoidsetC(double c)Sets the additive term, when set to one this is equivalent to adding a bias term of 1 to each vector.voidsetDegree(double d)Sets the degree of the polynomialjava.lang.StringtoString()A descriptive name for the type of KernelFunction-
Methods inherited from class jsat.distributions.kernels.BaseKernelTrick
addToCache, eval, eval, evalSum, evalSum, getAccelerationCache, getQueryInfo, normalized, supportsAcceleration
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Constructor Detail
-
PolynomialKernel
public PolynomialKernel(double degree, double alpha, double c)Creates a new polynomial kernel- Parameters:
degree- the degree of the polynomialalpha- the term to scale the dot product byc- the additive term
-
PolynomialKernel
public PolynomialKernel(double degree)
Defaults alpha = 1 and c = 1- Parameters:
degree- the degree of the polynomial
-
-
Method Detail
-
setAlpha
public void setAlpha(double alpha)
Sets the scaling factor for the dot product, this is equivalent to multiplying each value in the data set by a constant factor- Parameters:
alpha- the scaling factor
-
setC
public void setC(double c)
Sets the additive term, when set to one this is equivalent to adding a bias term of 1 to each vector. This is done after the scaling byalpha.- Parameters:
c- the non negative additive term
-
setDegree
public void setDegree(double d)
Sets the degree of the polynomial- Parameters:
d- the degree of the polynomial
-
getAlpha
public double getAlpha()
Returns the scaling parameter- Returns:
- the scaling parameter
-
getC
public double getC()
Returns the additive constant- Returns:
- the additive constant
-
getDegree
public double getDegree()
Returns the degree of the polynomial- Returns:
- the degree of the polynomial
-
eval
public double eval(Vec a, Vec b)
Description copied from interface:KernelTrickEvaluate this kernel function for the two given vectors.- Parameters:
a- the first vectorb- the first vector- Returns:
- the evaluation
-
toString
public java.lang.String toString()
Description copied from interface:KernelTrickA descriptive name for the type of KernelFunction- Specified by:
toStringin interfaceKernelTrick- Overrides:
toStringin classjava.lang.Object- Returns:
- a descriptive name for the type of KernelFunction
-
guessDegree
public static Distribution guessDegree(DataSet d)
Guesses the distribution to use for the degree parameter- Parameters:
d- the dataset to get the guess for- Returns:
- the guess for the degree parameter
- See Also:
setDegree(double)
-
clone
public PolynomialKernel clone()
- Specified by:
clonein interfaceKernelTrick- Specified by:
clonein classBaseKernelTrick
-
-
DataMelt 3.0 © DataMelt by jWork.ORG