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

Class weka.attributeSelection.RandomSearch

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

public class RandomSearch
extends ASSearch
implements StartSetHandler, OptionHandler
Class for performing a random search.

Valid options are:

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

-F Percentage of the search space to consider. (default = 25).

-V
Verbose output. Output new best subsets as the search progresses.

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

Constructor Index

 o RandomSearch()
Constructor

Method Index

 o getOptions()
Gets the current settings of RandomSearch.
 o getSearchPercent()
get the percentage of the search space to consider
 o getStartSet()
Returns a list of attributes (and or attribute ranges) as a String
 o getVerbose()
get whether or not output is verbose
 o listOptions()
Returns an enumeration describing the available options
 o search(ASEvaluation, Instances)
Searches the attribute subset space using a genetic algorithm.
 o setOptions(String[])
Parses a given list of options.
 o setSearchPercent(double)
set the percentage of the search space to consider
 o setStartSet(String)
Sets a starting set of attributes for the search.
 o setVerbose(boolean)
set whether or not to output new best subsets as the search proceeds
 o toString()
prints a description of the search

Constructors

 o RandomSearch
 public RandomSearch()
Constructor

Methods

 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.

-F Percentage of the search space to consider. (default = 25).

-V
Verbose output. Output new best subsets as the search progresses.

Parameters:
options - the list of options as an array of strings
Throws: Exception
if an option is not supported
 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. "" indicates no start point. If a start point is supplied, random search evaluates the start point and then looks for subsets that are as good as or better than the start point with the same or lower cardinality.
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 setVerbose
 public void setVerbose(boolean v)
set whether or not to output new best subsets as the search proceeds

Parameters:
v - true if output is to be verbose
 o getVerbose
 public boolean getVerbose()
get whether or not output is verbose

Returns:
true if output is set to verbose
 o setSearchPercent
 public void setSearchPercent(double p)
set the percentage of the search space to consider

Parameters:
p - percent of the search space ( 0 < p <= 100)
 o getSearchPercent
 public double getSearchPercent()
get the percentage of the search space to consider

Returns:
the percent of the search space explored
 o getOptions
 public String[] getOptions()
Gets the current settings of RandomSearch.

Returns:
an array of strings suitable for passing to setOptions()
 o toString
 public String toString()
prints 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 using a genetic algorithm.

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

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