Class PrecomputedKernelMatrixKernel
- java.lang.Object
-
- weka.classifiers.functions.supportVector.Kernel
-
- weka.classifiers.functions.supportVector.PrecomputedKernelMatrixKernel
-
- All Implemented Interfaces:
java.io.Serializable,CapabilitiesHandler,Copyable,OptionHandler,RevisionHandler
public class PrecomputedKernelMatrixKernel extends Kernel implements Copyable
This kernel is based on a static kernel matrix that is read from a file. Instances must have a single nominal attribute (excluding the class). This attribute must be the first attribute in the file and its values are used to reference rows/columns in the kernel matrix. The second attribute must be the class attribute. Valid options are:-D Enables debugging output (if available) to be printed. (default: off)
-no-checks Turns off all checks - use with caution! (default: checks on)
-M <file name> The file name of the file that holds the kernel matrix. (default: kernelMatrix.matrix)
- Version:
- $Revision: 9897 $
- Author:
- Eibe Frank (eibe@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PrecomputedKernelMatrixKernel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclean()Frees the memory used by the kernel.java.lang.Objectcopy()Return a shallow copy of this kerneldoubleeval(int id1, int id2, Instance inst1)Computes the result of the kernel function for two instances.CapabilitiesgetCapabilities()Returns the Capabilities of this kernel.java.io.FilegetKernelMatrixFile()Gets the file containing the kernel matrix.java.lang.String[]getOptions()Gets the current settings of the Kernel.java.lang.StringgetRevision()Returns the revision string.java.lang.StringglobalInfo()Returns a string describing the kerneljava.lang.StringkernelMatrixFileTipText()Returns the tip text for this propertyjava.util.EnumerationlistOptions()Returns an enumeration describing the available options.intnumCacheHits()Returns the number of dot product cache hits.intnumEvals()Returns the number of kernel evaluation performed.voidsetKernelMatrixFile(java.io.File f)Sets the file holding the kernel matrixvoidsetOptions(java.lang.String[] options)Parses a given list of options.java.lang.StringtoString()returns a string representation for the Kernel-
Methods inherited from class weka.classifiers.functions.supportVector.Kernel
buildKernel, checksTurnedOffTipText, debugTipText, forName, getChecksTurnedOff, getDebug, makeCopies, makeCopy, setChecksTurnedOff, setDebug
-
-
-
-
Method Detail
-
copy
public java.lang.Object copy()
Return a shallow copy of this kernel
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing the kernel- Specified by:
globalInfoin classKernel- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
listOptions
public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classKernel- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.ExceptionParses a given list of options. Valid options are:-D Enables debugging output (if available) to be printed. (default: off)
-no-checks Turns off all checks - use with caution! (default: checks on)
-M <file name> The file name of the file that holds the kernel matrix. (default: kernelMatrix.matrix)
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classKernel- Parameters:
options- the list of options as an array of strings- Throws:
java.lang.Exception- if an option is not supported
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of the Kernel.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classKernel- Returns:
- an array of strings suitable for passing to setOptions
-
eval
public double eval(int id1, int id2, Instance inst1) throws java.lang.ExceptionDescription copied from class:KernelComputes the result of the kernel function for two instances. If id1 == -1, eval use inst1 instead of an instance in the dataset.
-
getCapabilities
public Capabilities getCapabilities()
Returns the Capabilities of this kernel.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classKernel- Returns:
- the capabilities of this object
- See Also:
Capabilities
-
setKernelMatrixFile
public void setKernelMatrixFile(java.io.File f)
Sets the file holding the kernel matrix- Parameters:
value- the exponent value
-
getKernelMatrixFile
public java.io.File getKernelMatrixFile()
Gets the file containing the kernel matrix.- Returns:
- the exponent value
-
kernelMatrixFileTipText
public java.lang.String kernelMatrixFileTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
toString
public java.lang.String toString()
returns a string representation for the Kernel- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representaiton of the kernel
-
clean
public void clean()
Frees the memory used by the kernel. (Useful with kernels which use cache.) This function is called when the training is done. i.e. after that, eval will be called with id1 == -1.
-
numEvals
public int numEvals()
Returns the number of kernel evaluation performed.
-
numCacheHits
public int numCacheHits()
Returns the number of dot product cache hits.- Specified by:
numCacheHitsin classKernel- Returns:
- the number of dot product cache hits, or -1 if not supported by this kernel.
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classKernel- Returns:
- the revision
-
-