Package weka.attributeSelection
Class RandomSearch
- java.lang.Object
-
- weka.attributeSelection.ASSearch
-
- weka.attributeSelection.RandomSearch
-
- All Implemented Interfaces:
java.io.Serializable
,StartSetHandler
,OptionHandler
,RevisionHandler
,TechnicalInformationHandler
public class RandomSearch extends ASSearch implements StartSetHandler, OptionHandler, TechnicalInformationHandler
RandomSearch :
Performs a Random search in the space of attribute subsets. If no start set is supplied, Random search starts from a random point and reports the best subset found. If a start set is supplied, Random searches randomly for subsets that are as good or better than the start point with the same or or fewer attributes. Using RandomSearch in conjunction with a start set containing all attributes equates to the LVF algorithm of Liu and Setiono (ICML-96).
For more information see:
H. Liu, R. Setiono: A probabilistic approach to feature selection - A filter solution. In: 13th International Conference on Machine Learning, 319-327, 1996. BibTeX:@inproceedings{Liu1996, author = {H. Liu and R. Setiono}, booktitle = {13th International Conference on Machine Learning}, pages = {319-327}, title = {A probabilistic approach to feature selection - A filter solution}, year = {1996} }
Valid options are:-P <start set> Specify a starting set of attributes. Eg. 1,3,5-7. If a start point is supplied, random search evaluates the start point and then randomly looks for subsets that are as good as or better than the start point with the same or lower cardinality.
-F <percent> Percent of search space to consider. (default = 25%).
-V Output subsets as the search progresses. (default = false).
-seed <num> Random seed (default = 1)
- Version:
- $Revision: 8949 $
- Author:
- Mark Hall (mhall@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RandomSearch()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]
getOptions()
Gets the current settings of RandomSearch.java.lang.String
getRevision()
Returns the revision string.double
getSearchPercent()
get the percentage of the search space to considerint
getSeed()
Get the random seed to usejava.lang.String
getStartSet()
Returns a list of attributes (and or attribute ranges) as a StringTechnicalInformation
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.boolean
getVerbose()
get whether or not output is verbosejava.lang.String
globalInfo()
Returns a string describing this search methodjava.util.Enumeration
listOptions()
Returns an enumeration describing the available options.int[]
search(ASEvaluation ASEval, Instances data)
Searches the attribute subset space randomly.java.lang.String
searchPercentTipText()
Returns the tip text for this propertyjava.lang.String
seedTipText()
Returns the tip text for this propertyvoid
setOptions(java.lang.String[] options)
Parses a given list of options.void
setSearchPercent(double p)
set the percentage of the search space to considervoid
setSeed(int seed)
Set the random seed to usevoid
setStartSet(java.lang.String startSet)
Sets a starting set of attributes for the search.void
setVerbose(boolean v)
set whether or not to output new best subsets as the search proceedsjava.lang.String
startSetTipText()
Returns the tip text for this propertyjava.lang.String
toString()
prints a description of the searchjava.lang.String
verboseTipText()
Returns the tip text for this property-
Methods inherited from class weka.attributeSelection.ASSearch
forName, makeCopies
-
-
-
-
Method Detail
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing this search method- Returns:
- a description of the search suitable for displaying in the explorer/experimenter gui
-
getTechnicalInformation
public 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.- Specified by:
getTechnicalInformation
in interfaceTechnicalInformationHandler
- Returns:
- the technical information about this class
-
listOptions
public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceOptionHandler
- 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:-P <start set> Specify a starting set of attributes. Eg. 1,3,5-7. If a start point is supplied, random search evaluates the start point and then randomly looks for subsets that are as good as or better than the start point with the same or lower cardinality.
-F <percent> Percent of search space to consider. (default = 25%).
-V Output subsets as the search progresses. (default = false).
-seed <num> Random seed (default = 1)
- Specified by:
setOptions
in interfaceOptionHandler
- 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 RandomSearch.- Specified by:
getOptions
in interfaceOptionHandler
- Returns:
- an array of strings suitable for passing to setOptions()
-
startSetTipText
public java.lang.String startSetTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setStartSet
public void setStartSet(java.lang.String startSet) throws java.lang.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.- Specified by:
setStartSet
in interfaceStartSetHandler
- 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:
java.lang.Exception
- if start set can't be set.
-
getStartSet
public java.lang.String getStartSet()
Returns a list of attributes (and or attribute ranges) as a String- Specified by:
getStartSet
in interfaceStartSetHandler
- Returns:
- a list of attributes (and or attribute ranges)
-
verboseTipText
public java.lang.String verboseTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
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
-
getVerbose
public boolean getVerbose()
get whether or not output is verbose- Returns:
- true if output is set to verbose
-
searchPercentTipText
public java.lang.String searchPercentTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
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)
-
seedTipText
public java.lang.String seedTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setSeed
public void setSeed(int seed)
Set the random seed to use- Parameters:
seed
- the seed to use
-
getSeed
public int getSeed()
Get the random seed to use- Returns:
- the random seed
-
getSearchPercent
public double getSearchPercent()
get the percentage of the search space to consider- Returns:
- the percent of the search space explored
-
toString
public java.lang.String toString()
prints a description of the search- Overrides:
toString
in classjava.lang.Object
- Returns:
- a description of the search as a string
-
search
public int[] search(ASEvaluation ASEval, Instances data) throws java.lang.Exception
Searches the attribute subset space randomly.
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classASSearch
- Returns:
- the revision
-
-