weka.attributeSelection
Class RankSearch

java.lang.Object
  extended byweka.attributeSelection.ASSearch
      extended byweka.attributeSelection.RankSearch
All Implemented Interfaces:
OptionHandler, java.io.Serializable

public class RankSearch
extends ASSearch
implements OptionHandler

Class for evaluating a attribute ranking (given by a specified evaluator) using a specified subset evaluator.

Valid options are:

-A
Specify the attribute/subset evaluator to be used for generating the ranking. If a subset evaluator is specified then a forward selection search is used to produce a ranked list of attributes.

Version:
$Revision: 1.8 $
Author:
Mark Hall (mhall@cs.waikato.ac.nz)
See Also:
Serialized Form

Field Summary
private  ASEvaluation m_ASEval
          the attribute evaluator to use for generating the ranking
private  java.util.BitSet m_best_group
          the best subset found
private  double m_bestMerit
          the merit of the best subset found
private  int m_classIndex
          holds the class index
private  boolean m_hasClass
          does the data have a class
private  Instances m_Instances
          the training instances
private  int m_numAttribs
          number of attributes in the data
private  int[] m_Ranking
          will hold the attribute ranking
private  ASEvaluation m_SubsetEval
          the subset evaluator with which to evaluate the ranking
 
Constructor Summary
RankSearch()
           
 
Method Summary
 java.lang.String attributeEvaluatorTipText()
          Returns the tip text for this property
private  int[] attributeList(java.util.BitSet group)
          converts a BitSet into a list of attribute indexes
 ASEvaluation getAttributeEvaluator()
          Get the attribute evaluator used to generate the ranking.
 java.lang.String[] getOptions()
          Gets the current settings of WrapperSubsetEval.
 java.lang.String globalInfo()
          Returns a string describing this search method
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
protected  void resetOptions()
          Reset the search method.
 int[] search(ASEvaluation ASEval, Instances data)
          Ranks attributes using the specified attribute evaluator and then searches the ranking using the supplied subset evaluator.
 void setAttributeEvaluator(ASEvaluation newEvaluator)
          Set the attribute evaluator to use for generating the ranking.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 java.lang.String toString()
          returns a description of the search as a String
 
Methods inherited from class weka.attributeSelection.ASSearch
forName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_hasClass

private boolean m_hasClass
does the data have a class


m_classIndex

private int m_classIndex
holds the class index


m_numAttribs

private int m_numAttribs
number of attributes in the data


m_best_group

private java.util.BitSet m_best_group
the best subset found


m_ASEval

private ASEvaluation m_ASEval
the attribute evaluator to use for generating the ranking


m_SubsetEval

private ASEvaluation m_SubsetEval
the subset evaluator with which to evaluate the ranking


m_Instances

private Instances m_Instances
the training instances


m_bestMerit

private double m_bestMerit
the merit of the best subset found


m_Ranking

private int[] m_Ranking
will hold the attribute ranking

Constructor Detail

RankSearch

public RankSearch()
Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing this search method

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

attributeEvaluatorTipText

public java.lang.String attributeEvaluatorTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setAttributeEvaluator

public void setAttributeEvaluator(ASEvaluation newEvaluator)
Set the attribute evaluator to use for generating the ranking.

Parameters:
newEvaluator - the attribute evaluator to use.

getAttributeEvaluator

public ASEvaluation getAttributeEvaluator()
Get the attribute evaluator used to generate the ranking.

Returns:
the evaluator used to generate the ranking.

listOptions

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

Specified by:
listOptions in interface OptionHandler
Returns:
an enumeration of all the available options.

setOptions

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

-A

Specified by:
setOptions in interface OptionHandler
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 WrapperSubsetEval.

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

resetOptions

protected void resetOptions()
Reset the search method.


search

public int[] search(ASEvaluation ASEval,
                    Instances data)
             throws java.lang.Exception
Ranks attributes using the specified attribute evaluator and then searches the ranking using the supplied subset evaluator.

Specified by:
search in class ASSearch
Parameters:
data - the training instances.
ASEval - the attribute evaluator to guide the search
Returns:
an array (not necessarily ordered) of selected attribute indexes
Throws:
java.lang.Exception - if the search can't be completed

attributeList

private int[] attributeList(java.util.BitSet group)
converts a BitSet into a list of attribute indexes

Parameters:
group - the BitSet to convert
Returns:
an array of attribute indexes

toString

public java.lang.String toString()
returns a description of the search as a String

Returns:
a description of the search