Package weka.attributeSelection
Class BestFirst
java.lang.Object
weka.attributeSelection.ASSearch
weka.attributeSelection.BestFirst
- All Implemented Interfaces:
Serializable
,StartSetHandler
,OptionHandler
,RevisionHandler
BestFirst:
Searches the space of attribute subsets by greedy hillclimbing augmented with a backtracking facility. Setting the number of consecutive non-improving nodes allowed controls the level of backtracking done. Best first may start with the empty set of attributes and search forward, or start with the full set of attributes and search backward, or start at any point and search in both directions (by considering all possible single attribute additions and deletions at a given point).
Valid options are:
Searches the space of attribute subsets by greedy hillclimbing augmented with a backtracking facility. Setting the number of consecutive non-improving nodes allowed controls the level of backtracking done. Best first may start with the empty set of attributes and search forward, or start with the full set of attributes and search backward, or start at any point and search in both directions (by considering all possible single attribute additions and deletions at a given point).
Valid options are:
-P <start set> Specify a starting set of attributes. Eg. 1,3,5-7.
-D <0 = backward | 1 = forward | 2 = bi-directional> Direction of search. (default = 1).
-N <num> Number of non-improving nodes to consider before terminating search.
-S <num> Size of lookup cache for evaluated subsets. Expressed as a multiple of the number of attributes in the data set. (default = 1)
- Version:
- $Revision: 15519 $
- Author:
- Mark Hall (mhall@cs.waikato.ac.nz) Martin Guetlein (cashing merit of expanded nodes)
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Class for a node in a linked list.class
Class for handling a linked list. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the tip text for this propertyGet the search directionint
Return the maximum size of the evaluated subset cache (expressed as a multiplier for the number of attributes in a data set.String[]
Gets the current settings of BestFirst.Returns the revision string.int
Get the termination criterion (number of non-improving nodes).Returns a list of attributes (and or attribute ranges) as a StringReturns a string describing this search methodReturns an enumeration describing the available options.Returns the tip text for this propertyint[]
search
(ASEvaluation ASEval, Instances data) Searches the attribute subset space by best first searchReturns the tip text for this propertyvoid
Set the search directionvoid
setLookupCacheSize
(int size) Set the maximum size of the evaluated subset cache (hashtable).void
setOptions
(String[] options) Parses a given list of options.void
setSearchTermination
(int t) Set the numnber of non-improving nodes to consider before terminating search.void
setStartSet
(String startSet) Sets a starting set of attributes for the search.Returns the tip text for this propertytoString()
returns a description of the search as a StringMethods inherited from class weka.attributeSelection.ASSearch
forName, makeCopies
-
Field Details
-
TAGS_SELECTION
search directions
-
-
Constructor Details
-
BestFirst
public BestFirst()Constructor
-
-
Method Details
-
globalInfo
Returns a string describing this search method- Returns:
- a description of the search method suitable for displaying in the explorer/experimenter gui
-
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceOptionHandler
- Overrides:
listOptions
in classASSearch
- Returns:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:-P <start set> Specify a starting set of attributes. Eg. 1,3,5-7.
-D <0 = backward | 1 = forward | 2 = bi-directional> Direction of search. (default = 1).
-N <num> Number of non-improving nodes to consider before terminating search.
-S <num> Size of lookup cache for evaluated subsets. Expressed as a multiple of the number of attributes in the data set. (default = 1)
- Specified by:
setOptions
in interfaceOptionHandler
- Overrides:
setOptions
in classASSearch
- Parameters:
options
- the list of options as an array of strings- Throws:
Exception
- if an option is not supported
-
setLookupCacheSize
public void setLookupCacheSize(int size) Set the maximum size of the evaluated subset cache (hashtable). This is expressed as a multiplier for the number of attributes in the data set. (default = 1).- Parameters:
size
- the maximum size of the hashtable
-
getLookupCacheSize
public int getLookupCacheSize()Return the maximum size of the evaluated subset cache (expressed as a multiplier for the number of attributes in a data set.- Returns:
- the maximum size of the hashtable.
-
lookupCacheSizeTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
startSetTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setStartSet
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.- Throws:
Exception
- if start set can't be set.
-
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)
-
searchTerminationTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setSearchTermination
Set the numnber of non-improving nodes to consider before terminating search.- Parameters:
t
- the number of non-improving nodes- Throws:
Exception
- if t is less than 1
-
getSearchTermination
public int getSearchTermination()Get the termination criterion (number of non-improving nodes).- Returns:
- the number of non-improving nodes
-
directionTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setDirection
Set the search direction- Parameters:
d
- the direction of the search
-
getDirection
Get the search direction- Returns:
- the direction of the search
-
getOptions
Gets the current settings of BestFirst.- Specified by:
getOptions
in interfaceOptionHandler
- Overrides:
getOptions
in classASSearch
- Returns:
- an array of strings suitable for passing to setOptions()
-
toString
returns a description of the search as a String -
search
Searches the attribute subset space by best first search -
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classASSearch
- Returns:
- the revision
-