public abstract class Kernel extends java.lang.Object implements java.io.Serializable, OptionHandler
Modifier and Type | Field and Description |
---|---|
protected boolean |
m_ChecksTurnedOff
Turns off all checks
|
protected Instances |
m_data
The dataset
|
protected boolean |
m_Debug
enables debugging output
|
Constructor and Description |
---|
Kernel() |
Modifier and Type | Method and Description |
---|---|
void |
buildKernel(Instances data)
builds the kernel with the given data
|
java.lang.String |
checksTurnedOffTipText()
Returns the tip text for this property
|
abstract void |
clean()
Frees the memory used by the kernel.
|
java.lang.String |
debugTipText()
Returns the tip text for this property
|
abstract double |
eval(int id1,
int id2,
Instance inst1)
Computes the result of the kernel function for two instances.
|
static Kernel |
forName(java.lang.String kernelName,
java.lang.String[] options)
Creates a new instance of a kernel given it's class name and
(optional) arguments to pass to it's setOptions method.
|
boolean |
getChecksTurnedOff()
Returns whether the checks are turned off or not.
|
boolean |
getDebug()
Gets whether debugging output is turned on or not.
|
java.lang.String[] |
getOptions()
Gets the current settings of the Kernel.
|
abstract java.lang.String |
globalInfo()
Returns a string describing the kernel
|
protected void |
initVars(Instances data)
initializes variables etc.
|
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
static Kernel[] |
makeCopies(Kernel model,
int num)
Creates a given number of deep copies of the given kernel using
serialization.
|
static Kernel |
makeCopy(Kernel kernel)
Creates a deep copy of the given kernel using serialization.
|
abstract int |
numCacheHits()
Returns the number of dot product cache hits.
|
abstract int |
numEvals()
Returns the number of kernel evaluation performed.
|
void |
setChecksTurnedOff(boolean value)
Disables or enables the checks (which could be time-consuming).
|
void |
setDebug(boolean value)
Enables or disables the output of debug information (if the derived
kernel supports that)
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
protected Instances m_data
protected boolean m_Debug
protected boolean m_ChecksTurnedOff
public abstract java.lang.String globalInfo()
public abstract double eval(int id1, int id2, Instance inst1) throws java.lang.Exception
id1
- the index of the first instance in the datasetid2
- the index of the second instance in the datasetinst1
- the instance corresponding to id1 (used if id1 == -1)java.lang.Exception
- if something goes wrongpublic abstract void clean()
public abstract int numEvals()
public abstract int numCacheHits()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public void setDebug(boolean value)
value
- whether to output debugging informationpublic boolean getDebug()
public java.lang.String debugTipText()
public void setChecksTurnedOff(boolean value)
value
- if true turns off all checkspublic boolean getChecksTurnedOff()
public java.lang.String checksTurnedOffTipText()
protected void initVars(Instances data)
data
- the data to usepublic void buildKernel(Instances data) throws java.lang.Exception
data
- the data to base the kernel onjava.lang.Exception
- if something goes wrongpublic static Kernel makeCopy(Kernel kernel) throws java.lang.Exception
kernel
- the kernel to copyjava.lang.Exception
- if an error occurspublic static Kernel[] makeCopies(Kernel model, int num) throws java.lang.Exception
model
- the kernel to copynum
- the number of kernel copies to create.java.lang.Exception
- if an error occurspublic static Kernel forName(java.lang.String kernelName, java.lang.String[] options) throws java.lang.Exception
kernelName
- the fully qualified class name of the classifieroptions
- an array of options suitable for passing to setOptions. May
be null.java.lang.Exception
- if the classifier name is invalid, or the options
supplied are not acceptable to the classifier