public class KernelFilter extends SimpleBatchFilter implements UnsupervisedFilter, TechnicalInformationHandler
@inproceedings{Bennett2003, author = {K.P. Bennett and M.J. Embrechts}, booktitle = {Advances in Learning Theory: Methods, Models and Applications}, editor = {J. Suykens et al.}, pages = {227-249}, publisher = {IOS Press, Amsterdam, The Netherlands}, series = {NATO Science Series, Series III: Computer and System Sciences}, title = {An Optimization Perspective on Kernel Partial Least Squares Regression}, volume = {190}, year = {2003} }Valid options are:
-D Turns on output of debugging information.
-no-checks Turns off all checks - use with caution! Turning them off assumes that data is purely numeric, doesn't contain any missing values, and has a nominal class. Turning them off also means that no header information will be stored if the machine is linear. Finally, it also assumes that no instance has a weight equal to 0. (default: checks on)
-F <filename> The file to initialize the filter with (optional).
-C <num> The class index for the file to initialize with, First and last are valid (optional, default: last).
-K <classname and parameters> The Kernel to use. (default: weka.classifiers.functions.supportVector.PolyKernel)
-kernel-factor Defines a factor for the kernel. - RBFKernel: a factor for gamma Standardize: 1/(2*N) Normalize..: 6/N Available parameters are: N for # of instances, A for # of attributes (default: 1)
-P <classname and parameters> The Filter used for preprocessing (use weka.filters.AllFilter to disable preprocessing). (default: weka.filters.unsupervised.attribute.Center)
Options specific to kernel weka.classifiers.functions.supportVector.PolyKernel:
-D Enables debugging output (if available) to be printed. (default: off)
-no-checks Turns off all checks - use with caution! (default: checks on)
-C <num> The size of the cache (a prime number), 0 for full cache and -1 to turn it off. (default: 250007)
-E <num> The Exponent to use. (default: 1.0)
-L Use lower-order terms. (default: no)
Options specific to preprocessing filter weka.filters.unsupervised.attribute.Center:
-unset-class-temporarily Unsets the class index temporarily before the filter is applied to the data. (default: no)
Modifier and Type | Field and Description |
---|---|
protected Filter |
m_ActualFilter
for centering/standardizing the data (the actual filter to use)
|
protected Kernel |
m_ActualKernel
the Kernel which is actually used for computation
|
protected boolean |
m_checksTurnedOff
Turn off all checks and conversions? Turning them off assumes
that data is purely numeric, doesn't contain any missing values,
and has a nominal class.
|
protected Filter |
m_Filter
for centering/standardizing the data
|
protected File |
m_InitFile
The dataset to initialize the filter with
|
protected SingleIndex |
m_InitFileClassIndex
the class index for the file to initialized with
|
protected boolean |
m_Initialized
whether the filter was initialized
|
protected Kernel |
m_Kernel
Kernel to use
|
protected double |
m_KernelFactor
the calculated kernel factor
|
protected String |
m_KernelFactorExpression
optimizes the kernel with this formula
(A = # of attributes, N = # of instances)
|
protected ReplaceMissingValues |
m_Missing
The filter used to get rid of missing values.
|
protected NominalToBinary |
m_NominalToBinary
The filter used to make attributes numeric.
|
protected int |
m_NumTrainInstances
The number of instances in the training data.
|
m_Debug
m_FirstBatchDone, m_InputRelAtts, m_InputStringAtts, m_NewBatch, m_OutputRelAtts, m_OutputStringAtts
Constructor and Description |
---|
KernelFilter() |
Modifier and Type | Method and Description |
---|---|
String |
checksTurnedOffTipText()
Returns the tip text for this property
|
protected Instances |
determineOutputFormat(Instances inputFormat)
Determines the output format based on the input format and returns
this.
|
Capabilities |
getCapabilities()
Returns the Capabilities of this filter.
|
boolean |
getChecksTurnedOff()
Returns whether the checks are turned off or not.
|
File |
getInitFile()
Gets the file to initialize the filter with, can be null.
|
String |
getInitFileClassIndex()
Gets the class index of the file to initialize the filter with.
|
Kernel |
getKernel()
Gets the kernel to use.
|
String |
getKernelFactorExpression()
Gets the expression for the kernel.
|
String[] |
getOptions()
Gets the current settings of the filter.
|
Filter |
getPreprocessing()
Gets the filter used for preprocessing
|
String |
getRevision()
Returns the revision string.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing
detailed information about the technical background of this class,
e.g., paper reference or book this class is based on.
|
String |
globalInfo()
Returns a string describing this filter.
|
String |
initFileClassIndexTipText()
Returns the tip text for this property
|
String |
initFileTipText()
Returns the tip text for this property
|
void |
initFilter(Instances instances)
initializes the filter with the given dataset, i.e., the kernel gets
built.
|
String |
kernelFactorExpressionTipText()
Returns the tip text for this property
|
String |
kernelTipText()
Returns the tip text for this property
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] args)
runs the filter with the given arguments
|
String |
preprocessingTipText()
Returns the tip text for this property
|
protected Instances |
process(Instances instances)
Processes the given data (may change the provided dataset) and returns
the modified version.
|
protected void |
reset()
resets the filter, i.e., m_NewBatch to true and m_FirstBatchDone to
false.
|
void |
setChecksTurnedOff(boolean value)
Disables or enables the checks (which could be time-consuming).
|
void |
setInitFile(File value)
Sets the file to initialize the filter with, can be null.
|
void |
setInitFileClassIndex(String value)
Sets class index of the file to initialize the filter with.
|
void |
setKernel(Kernel value)
Sets the kernel to use.
|
void |
setKernelFactorExpression(String value)
Sets the expression for the kernel.
|
void |
setOptions(String[] options)
Parses a given list of options.
|
void |
setPreprocessing(Filter value)
Sets the filter to use for preprocessing (use the AllFilter for no
preprocessing)
|
batchFinished, hasImmediateOutputFormat, input
debugTipText, getDebug, setDebug, setInputFormat
batchFilterFile, bufferInput, copyValues, copyValues, filterFile, flushInput, getCapabilities, getInputFormat, getOutputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, numPendingOutput, output, outputFormatPeek, outputPeek, push, resetQueue, runFilter, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapper
protected int m_NumTrainInstances
protected Kernel m_Kernel
protected Kernel m_ActualKernel
protected boolean m_checksTurnedOff
protected NominalToBinary m_NominalToBinary
protected ReplaceMissingValues m_Missing
protected File m_InitFile
protected SingleIndex m_InitFileClassIndex
m_InitFile
protected boolean m_Initialized
protected String m_KernelFactorExpression
protected double m_KernelFactor
m_KernelFactorExpression
protected Filter m_Filter
protected Filter m_ActualFilter
public String globalInfo()
globalInfo
in class SimpleFilter
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class SimpleFilter
public String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class SimpleFilter
public void setOptions(String[] options) throws Exception
-D Turns on output of debugging information.
-no-checks Turns off all checks - use with caution! Turning them off assumes that data is purely numeric, doesn't contain any missing values, and has a nominal class. Turning them off also means that no header information will be stored if the machine is linear. Finally, it also assumes that no instance has a weight equal to 0. (default: checks on)
-F <filename> The file to initialize the filter with (optional).
-C <num> The class index for the file to initialize with, First and last are valid (optional, default: last).
-K <classname and parameters> The Kernel to use. (default: weka.classifiers.functions.supportVector.PolyKernel)
-kernel-factor Defines a factor for the kernel. - RBFKernel: a factor for gamma Standardize: 1/(2*N) Normalize..: 6/N Available parameters are: N for # of instances, A for # of attributes (default: 1)
-P <classname and parameters> The Filter used for preprocessing (use weka.filters.AllFilter to disable preprocessing). (default: weka.filters.unsupervised.attribute.Center)
Options specific to kernel weka.classifiers.functions.supportVector.PolyKernel:
-D Enables debugging output (if available) to be printed. (default: off)
-no-checks Turns off all checks - use with caution! (default: checks on)
-C <num> The size of the cache (a prime number), 0 for full cache and -1 to turn it off. (default: 250007)
-E <num> The Exponent to use. (default: 1.0)
-L Use lower-order terms. (default: no)
Options specific to preprocessing filter weka.filters.unsupervised.attribute.Center:
-unset-class-temporarily Unsets the class index temporarily before the filter is applied to the data. (default: no)
setOptions
in interface OptionHandler
setOptions
in class SimpleFilter
options
- the list of options as an array of stringsException
- if an option is not supportedSimpleFilter.reset()
public String initFileTipText()
public File getInitFile()
public void setInitFile(File value)
value
- the filepublic String initFileClassIndexTipText()
public String getInitFileClassIndex()
public void setInitFileClassIndex(String value)
value
- the class indexpublic String kernelTipText()
public Kernel getKernel()
public void setKernel(Kernel value)
value
- the kernelpublic void setChecksTurnedOff(boolean value)
value
- if true turns off all checkspublic boolean getChecksTurnedOff()
public String checksTurnedOffTipText()
public String kernelFactorExpressionTipText()
public String getKernelFactorExpression()
public void setKernelFactorExpression(String value)
value
- the filepublic String preprocessingTipText()
public void setPreprocessing(Filter value)
value
- the preprocessing filterpublic Filter getPreprocessing()
protected void reset()
reset
in class SimpleFilter
Filter.m_NewBatch
,
Filter.m_FirstBatchDone
protected Instances determineOutputFormat(Instances inputFormat) throws Exception
determineOutputFormat
in class SimpleFilter
inputFormat
- the input format to base the output format onException
- in case the determination goes wrongSimpleBatchFilter.hasImmediateOutputFormat()
,
SimpleBatchFilter.batchFinished()
public void initFilter(Instances instances) throws Exception
instances
- the data to initialize withException
- if building of kernel failspublic Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Filter
Capabilities
protected Instances process(Instances instances) throws Exception
process
in class SimpleFilter
instances
- the data to processException
- in case the processing goes wrongSimpleBatchFilter.batchFinished()
public String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Filter
public static void main(String[] args)
args
- the commandline argumentsCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.