

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object gov.sandia.cognition.util.AbstractCloneableSerializable gov.sandia.cognition.learning.function.kernel.PolynomialKernel
@CodeReview(reviewer="Kevin R. Dixon", date="20090708", changesNeeded=false, comments="Looks fine.") public class PolynomialKernel
The PolynomialKernel
class implements a kernel for two given
vectors that is the polynomial function:
(x dot y + c)^d
d is the degree of the polynomial, which must be a positive integer. c is
the constant that is used, which should be a nonnegative number. Normally c
is either 0.0 or 1.0.
Field Summary  

protected double 
constant
The constant for the polynomial. 
static double 
DEFAULT_CONSTANT
The default constant is 1.0. 
static int 
DEFAULT_DEGREE
The default degree is 2. 
protected int 
degree
The degree of the polynomial. 
Constructor Summary  

PolynomialKernel()
Creates a new instance of PolynomialKernel with a degree of 2 and a constant of 1.0. 

PolynomialKernel(int degree)
Creates a new instance of PolynomialKernel with the given degree and a constant of 1.0. 

PolynomialKernel(int degree,
double constant)
Creates a new instance of PolynomialKernel with the given degree and constant. 

PolynomialKernel(PolynomialKernel other)
Creates a new copy of a PolynomialKernel. 
Method Summary  

PolynomialKernel 
clone()
This makes public the clone method on the Object class and
removes the exception that it throws. 
double 
evaluate(Vectorizable x,
Vectorizable y)
This kernel just evaluates the polynomial kernel between the two given vectors, which is: (x dot y + c)^d. 
double 
getConstant()
Gets the constant of the polynomial. 
int 
getDegree()
Gets the degree of the polynomial. 
void 
setConstant(double constant)
Gets the constant of the polynomial. 
void 
setDegree(int degree)
Sets the degree of the polynomial. 
Methods inherited from class java.lang.Object 

equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 

public static final int DEFAULT_DEGREE
public static final double DEFAULT_CONSTANT
protected int degree
protected double constant
Constructor Detail 

public PolynomialKernel()
public PolynomialKernel(int degree)
degree
 The degree of the kernel. Must be positive.public PolynomialKernel(int degree, double constant)
degree
 The degree of the kernel. Must be positive.constant
 The constant of the kernel. Must be nonnegative.public PolynomialKernel(PolynomialKernel other)
other
 The PolynomialKernel to copy.Method Detail 

public PolynomialKernel clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.
clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public double evaluate(Vectorizable x, Vectorizable y)
evaluate
in interface Kernel<Vectorizable>
x
 The first vector.y
 The second vector.
public int getDegree()
public void setDegree(int degree)
degree
 The degree of the polynomial. Must be positive.public double getConstant()
public void setConstant(double constant)
constant
 The constant of the polynomial. Must be nonnegative.


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 