weka.attributeSelection
Class SVMAttributeEval

java.lang.Object
  extended byweka.attributeSelection.ASEvaluation
      extended byweka.attributeSelection.AttributeEvaluator
          extended byweka.attributeSelection.SVMAttributeEval
All Implemented Interfaces:
OptionHandler, java.io.Serializable

public class SVMAttributeEval
extends AttributeEvaluator
implements OptionHandler

Class for Evaluating attributes individually by using the SVM classifier. Attributes are ranked by the square of the weight assigned by the SVM. Attribute selection for multiclass problems is handled by ranking attributes for each class seperately using a one-vs-all method and then "dealing" from the top of each pile to give a final ranking.

Valid options are:

-X
Specify constant rate at which attributes are eliminated per invocation of the support vector machine. Default = 1.

-Y
Specify the percentage rate at which attributes are eliminated per invocation of the support vector machine. This setting trumps the constant rate setting. Default = 0 (percentage rate ignored).

-Z
Specify the threshold below which the percentage elimination method reverts to the constant elimination method.

-C
Specify the value of C - the complexity parameter to be passed on to the support vector machine.

-P
Sets the epsilon for round-off error. (default 1.0e-25)

-T
Sets the tolerance parameter. (default 1.0e-10)

Version:
$Revision: 1.17 $
Author:
Eibe Frank (eibe@cs.waikato.ac.nz), Mark Hall (mhall@cs.waikato.ac.nz)
See Also:
Serialized Form

Field Summary
private  double[] m_attScores
          The attribute scores
private  int m_numToEliminate
          Constant rate of attribute elimination per iteration
private  int m_percentThreshold
          Threshold below which percent elimination switches to constant elimination
private  int m_percentToEliminate
          Percentage rate of attribute elimination, trumps constant rate (above threshold), ignored if = 0
private  double m_smoCParameter
          Complexity parameter to pass on to SMO
private  int m_smoFilterType
          Filter parameter to pass on to SMO
private  double m_smoPParameter
          Epsilon parameter to pass on to SMO
private  double m_smoTParameter
          Tolerance parameter to pass on to SMO
 
Constructor Summary
SVMAttributeEval()
          Constructor
 
Method Summary
 java.lang.String attsToEliminatePerIterationTipText()
          Returns a tip text for this property suitable for display in the GUI
 void buildEvaluator(Instances data)
          Initializes the evaluator.
 java.lang.String complexityParameterTipText()
          Returns a tip text for this property suitable for display in the GUI
 java.lang.String epsilonParameterTipText()
          Returns a tip text for this property suitable for display in the GUI
 double evaluateAttribute(int attribute)
          Evaluates an attribute by returning the rank of the square of its coefficient in a linear support vector machine.
 java.lang.String filterTypeTipText()
          Returns a tip text for this property suitable for display in the GUI
 int getAttsToEliminatePerIteration()
          Get the constant rate of attribute elimination per iteration
 double getComplexityParameter()
          Get the value of C used with SMO
 double getEpsilonParameter()
          Get the value of P used with SMO
 SelectedTag getFilterType()
          Get the filtering mode passed to SMO
 java.lang.String[] getOptions()
          Gets the current settings of SVMAttributeEval
 int getPercentThreshold()
          Get the threshold below which percentage elimination reverts to constant elimination.
 int getPercentToEliminatePerIteration()
          Get the percentage rate of attribute elimination per iteration
 double getToleranceParameter()
          Get the value of T used with SMO
 java.lang.String globalInfo()
          Returns a string describing this attribute evaluator
 java.util.Enumeration listOptions()
          Returns an enumeration describing all the available options
static void main(java.lang.String[] args)
          Main method for testing this class.
 java.lang.String percentThresholdTipText()
          Returns a tip text for this property suitable for display in the GUI
 java.lang.String percentToEliminatePerIterationTipText()
          Returns a tip text for this property suitable for display in the GUI
private  int[] rankBySVM(int classInd, Instances data)
          Get SVM-ranked attribute indexes (best to worst) selected for the class attribute indexed by classInd (one-vs-all).
protected  void resetOptions()
          Resets options to defaults.
 void setAttsToEliminatePerIteration(int cRate)
          Set the constant rate of attribute elimination per iteration
 void setComplexityParameter(double svmC)
          Set the value of C for SMO
 void setEpsilonParameter(double svmP)
          Set the value of P for SMO
 void setFilterType(SelectedTag newType)
          The filtering mode to pass to SMO
 void setOptions(java.lang.String[] options)
          Parses a given list of options Valid options are: -X
Specify constant rate at which attributes are eliminated per invocation of the support vector machine.
 void setPercentThreshold(int pThresh)
          Set the threshold below which percentage elimination reverts to constant elimination.
 void setPercentToEliminatePerIteration(int pRate)
          Set the percentage of attributes to eliminate per iteration
 void setToleranceParameter(double svmT)
          Set the value of T for SMO
 java.lang.String toleranceParameterTipText()
          Returns a tip text for this property suitable for display in the GUI
 java.lang.String toString()
          Return a description of the evaluator
 
Methods inherited from class weka.attributeSelection.ASEvaluation
forName, makeCopies, postProcess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_attScores

private double[] m_attScores
The attribute scores


m_numToEliminate

private int m_numToEliminate
Constant rate of attribute elimination per iteration


m_percentToEliminate

private int m_percentToEliminate
Percentage rate of attribute elimination, trumps constant rate (above threshold), ignored if = 0


m_percentThreshold

private int m_percentThreshold
Threshold below which percent elimination switches to constant elimination


m_smoCParameter

private double m_smoCParameter
Complexity parameter to pass on to SMO


m_smoTParameter

private double m_smoTParameter
Tolerance parameter to pass on to SMO


m_smoPParameter

private double m_smoPParameter
Epsilon parameter to pass on to SMO


m_smoFilterType

private int m_smoFilterType
Filter parameter to pass on to SMO

Constructor Detail

SVMAttributeEval

public SVMAttributeEval()
Constructor

Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing this attribute evaluator

Returns:
a description of the evaluator suitable for displaying in the explorer/experimenter gui

listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing all the available options

Specified by:
listOptions in interface OptionHandler
Returns:
an enumeration of options

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options Valid options are:

-X
Specify constant rate at which attributes are eliminated per invocation of the support vector machine. Default = 1.

-Y
Specify the percentage rate at which attributes are eliminated per invocation of the support vector machine. This setting trumps the constant rate setting. Default = 0 (percentage rate ignored).

-Z
Specify the threshold below which the percentage elimination method reverts to the constant elimination method.

-C
Specify the value of C - the complexity parameter to be passed on to the support vector machine.

-P
Sets the epsilon for round-off error. (default 1.0e-25)

-T
Sets the tolerance parameter. (default 1.0e-10)

-N <0|1|2>
Whether the SVM should 0=normalize/1=standardize/2=neither. (default 0=normalize)

Specified by:
setOptions in interface OptionHandler
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an error occurs

getOptions

public java.lang.String[] getOptions()
Gets the current settings of SVMAttributeEval

Specified by:
getOptions in interface OptionHandler
Returns:
an array of strings suitable for passing to setOptions()

attsToEliminatePerIterationTipText

public java.lang.String attsToEliminatePerIterationTipText()
Returns a tip text for this property suitable for display in the GUI

Returns:
tip text string describing this property

percentToEliminatePerIterationTipText

public java.lang.String percentToEliminatePerIterationTipText()
Returns a tip text for this property suitable for display in the GUI

Returns:
tip text string describing this property

percentThresholdTipText

public java.lang.String percentThresholdTipText()
Returns a tip text for this property suitable for display in the GUI

Returns:
tip text string describing this property

epsilonParameterTipText

public java.lang.String epsilonParameterTipText()
Returns a tip text for this property suitable for display in the GUI

Returns:
tip text string describing this property

toleranceParameterTipText

public java.lang.String toleranceParameterTipText()
Returns a tip text for this property suitable for display in the GUI

Returns:
tip text string describing this property

complexityParameterTipText

public java.lang.String complexityParameterTipText()
Returns a tip text for this property suitable for display in the GUI

Returns:
tip text string describing this property

filterTypeTipText

public java.lang.String filterTypeTipText()
Returns a tip text for this property suitable for display in the GUI

Returns:
tip text string describing this property

setAttsToEliminatePerIteration

public void setAttsToEliminatePerIteration(int cRate)
Set the constant rate of attribute elimination per iteration


getAttsToEliminatePerIteration

public int getAttsToEliminatePerIteration()
Get the constant rate of attribute elimination per iteration

Returns:
the constant rate of attribute elimination per iteration

setPercentToEliminatePerIteration

public void setPercentToEliminatePerIteration(int pRate)
Set the percentage of attributes to eliminate per iteration


getPercentToEliminatePerIteration

public int getPercentToEliminatePerIteration()
Get the percentage rate of attribute elimination per iteration

Returns:
the percentage rate of attribute elimination per iteration

setPercentThreshold

public void setPercentThreshold(int pThresh)
Set the threshold below which percentage elimination reverts to constant elimination.


getPercentThreshold

public int getPercentThreshold()
Get the threshold below which percentage elimination reverts to constant elimination.

Returns:
the threshold below which percentage elimination stops

setEpsilonParameter

public void setEpsilonParameter(double svmP)
Set the value of P for SMO

Parameters:
svmP - the value of P

getEpsilonParameter

public double getEpsilonParameter()
Get the value of P used with SMO

Returns:
the value of P

setToleranceParameter

public void setToleranceParameter(double svmT)
Set the value of T for SMO


getToleranceParameter

public double getToleranceParameter()
Get the value of T used with SMO

Returns:
the value of T

setComplexityParameter

public void setComplexityParameter(double svmC)
Set the value of C for SMO

Parameters:
svmC - the value of C

getComplexityParameter

public double getComplexityParameter()
Get the value of C used with SMO

Returns:
the value of C

setFilterType

public void setFilterType(SelectedTag newType)
The filtering mode to pass to SMO

Parameters:
newType - the new filtering mode

getFilterType

public SelectedTag getFilterType()
Get the filtering mode passed to SMO

Returns:
the filtering mode

buildEvaluator

public void buildEvaluator(Instances data)
                    throws java.lang.Exception
Initializes the evaluator.

Specified by:
buildEvaluator in class ASEvaluation
Parameters:
data - set of instances serving as training data
Throws:
java.lang.Exception - if the evaluator has not been generated successfully

rankBySVM

private int[] rankBySVM(int classInd,
                        Instances data)
Get SVM-ranked attribute indexes (best to worst) selected for the class attribute indexed by classInd (one-vs-all).


resetOptions

protected void resetOptions()
Resets options to defaults.


evaluateAttribute

public double evaluateAttribute(int attribute)
                         throws java.lang.Exception
Evaluates an attribute by returning the rank of the square of its coefficient in a linear support vector machine.

Specified by:
evaluateAttribute in class AttributeEvaluator
Parameters:
attribute - the index of the attribute to be evaluated
Returns:
the "merit" of the attribute
Throws:
java.lang.Exception - if the attribute could not be evaluated

toString

public java.lang.String toString()
Return a description of the evaluator

Returns:
description as a string

main

public static void main(java.lang.String[] args)
Main method for testing this class.

Parameters:
args - the options