All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.attributeSelection.ForwardSelection

java.lang.Object
   |
   +----weka.attributeSelection.ASSearch
           |
           +----weka.attributeSelection.ForwardSelection

public class ForwardSelection
extends ASSearch
implements RankedOutputSearch, StartSetHandler, OptionHandler
Class for performing a forward selection hill climbing search.

Valid options are:

-P
Specify a starting set of attributes. Eg 1,4,7-9.

-R
Produce a ranked list of attributes.

-T
Specify a threshold by which the AttributeSelection module can.
discard attributes. Use in conjunction with -R

Version:
$Revision: 1.6 $
Author:
Mark Hall (mhall@cs.waikato.ac.nz)

Constructor Index

 o ForwardSelection()

Method Index

 o getGenerateRanking()
Gets whether ranking has been requested.
 o getOptions()
Gets the current settings of ReliefFAttributeEval.
 o getStartSet()
Returns a list of attributes (and or attribute ranges) as a String
 o getThreshold()
Returns the threshold so that the AttributeSelection module can discard attributes from the ranking.
 o listOptions()
Returns an enumeration describing the available options
 o rankedAttributes()
Produces a ranked list of attributes.
 o search(ASEvaluation, Instances)
Searches the attribute subset space by forward selection.
 o setGenerateRanking(boolean)
Records whether the user has requested a ranked list of attributes.
 o setOptions(String[])
Parses a given list of options.
 o setStartSet(String)
Sets a starting set of attributes for the search.
 o setThreshold(double)
Set the threshold by which the AttributeSelection module can discard attributes.
 o toString()
returns a description of the search.

Constructors

 o ForwardSelection
 public ForwardSelection()

Methods

 o setThreshold
 public void setThreshold(double threshold)
Set the threshold by which the AttributeSelection module can discard attributes.

Parameters:
threshold - the threshold.
 o getThreshold
 public double getThreshold()
Returns the threshold so that the AttributeSelection module can discard attributes from the ranking.

 o setGenerateRanking
 public void setGenerateRanking(boolean doRank)
Records whether the user has requested a ranked list of attributes.

Parameters:
doRank - true if ranking is requested
 o getGenerateRanking
 public boolean getGenerateRanking()
Gets whether ranking has been requested. This is used by the AttributeSelection module to determine if rankedAttributes() should be called.

Returns:
true if ranking has been requested.
 o setStartSet
 public void setStartSet(String startSet) throws Exception
Sets a starting set of attributes for the search. It is the search method's responsibility to report this start set (if any) in its toString() method.

Parameters:
startSet - a string containing a list of attributes (and or ranges), eg. 1,2,6,10-15.
Throws: Exception
if start set can't be set.
 o getStartSet
 public String getStartSet()
Returns a list of attributes (and or attribute ranges) as a String

Returns:
a list of attributes (and or attribute ranges)
 o listOptions
 public Enumeration listOptions()
Returns an enumeration describing the available options

Returns:
an enumeration of all the available options
 o setOptions
 public void setOptions(String options[]) throws Exception
Parses a given list of options. Valid options are:

-P
Specify a starting set of attributes. Eg 1,4,7-9.

-R
Produce a ranked list of attributes.

-T
Specify a threshold by which the AttributeSelection module can.
discard attributes. Use in conjunction with -R

Parameters:
options - the list of options as an array of strings
Throws: Exception
if an option is not supported
 o getOptions
 public String[] getOptions()
Gets the current settings of ReliefFAttributeEval.

Returns:
an array of strings suitable for passing to setOptions()
 o toString
 public String toString()
returns a description of the search.

Returns:
a description of the search as a String.
Overrides:
toString in class Object
 o search
 public int[] search(ASEvaluation ASEval,
                     Instances data) throws Exception
Searches the attribute subset space by forward selection.

Parameters:
ASEvaluator - the attribute evaluator to guide the search
data - the training instances.
Returns:
an array (not necessarily ordered) of selected attribute indexes
Throws: Exception
if the search can't be completed
Overrides:
search in class ASSearch
 o rankedAttributes
 public double[][] rankedAttributes() throws Exception
Produces a ranked list of attributes. Search must have been performed prior to calling this function. Search is called by this function to complete the traversal of the the search space. A list of attributes and merits are returned. The attributes a ranked by the order they are added to the subset during a forward selection search. Individual merit values reflect the merit associated with adding the corresponding attribute to the subset; because of this, merit values will initially increase but then decrease as the best subset is "passed by" on the way to the far side of the search space.

Returns:
an array of attribute indexes and associated merit values
Throws: Exception
if something goes wrong.

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home