public class BestFirst extends ASSearch implements OptionHandler, StartSetHandler
-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)
Modifier and Type | Class and Description |
---|---|
class |
BestFirst.Link2
Class for a node in a linked list.
|
class |
BestFirst.LinkedList2
Class for handling a linked list.
|
Modifier and Type | Field and Description |
---|---|
protected double |
m_bestMerit
holds the merit of the best subset found
|
protected int |
m_cacheSize
holds the maximum size of the lookup cache for evaluated subsets
|
protected int |
m_classIndex
holds the class index
|
protected boolean |
m_debug
for debugging
|
protected boolean |
m_hasClass
does the data have a class
|
protected int |
m_maxStale
maximum number of stale nodes before terminating search
|
protected int |
m_numAttribs
number of attributes in the data
|
protected int |
m_searchDirection
0 == backward search, 1 == forward search, 2 == bidirectional
|
protected int[] |
m_starting
holds an array of starting attributes
|
protected Range |
m_startRange
holds the start set for the search as a Range
|
protected int |
m_totalEvals
total number of subsets evaluated during a search
|
protected static int |
SELECTION_BACKWARD
search direction: backward
|
protected static int |
SELECTION_BIDIRECTIONAL
search direction: bidirectional
|
protected static int |
SELECTION_FORWARD
search direction: forward
|
static Tag[] |
TAGS_SELECTION
search directions
|
Constructor and Description |
---|
BestFirst()
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected int[] |
attributeList(BitSet group)
converts a BitSet into a list of attribute indexes
|
String |
directionTipText()
Returns the tip text for this property
|
SelectedTag |
getDirection()
Get the search direction
|
int |
getLookupCacheSize()
Return the maximum size of the evaluated subset cache (expressed as a multiplier
for the number of attributes in a data set.
|
String[] |
getOptions()
Gets the current settings of BestFirst.
|
String |
getRevision()
Returns the revision string.
|
int |
getSearchTermination()
Get the termination criterion (number of non-improving nodes).
|
String |
getStartSet()
Returns a list of attributes (and or attribute ranges) as a String
|
String |
globalInfo()
Returns a string describing this search method
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
String |
lookupCacheSizeTipText()
Returns the tip text for this property
|
protected void |
printGroup(BitSet tt,
int numAttribs) |
protected void |
resetOptions()
Reset options to default values
|
int[] |
search(ASEvaluation ASEval,
Instances data)
Searches the attribute subset space by best first search
|
String |
searchTerminationTipText()
Returns the tip text for this property
|
void |
setDirection(SelectedTag d)
Set the search direction
|
void |
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.
|
String |
startSetTipText()
Returns the tip text for this property
|
String |
toString()
returns a description of the search as a String
|
forName, makeCopies
protected int m_maxStale
protected int m_searchDirection
protected static final int SELECTION_BACKWARD
protected static final int SELECTION_FORWARD
protected static final int SELECTION_BIDIRECTIONAL
public static final Tag[] TAGS_SELECTION
protected int[] m_starting
protected Range m_startRange
protected boolean m_hasClass
protected int m_classIndex
protected int m_numAttribs
protected int m_totalEvals
protected boolean m_debug
protected double m_bestMerit
protected int m_cacheSize
public String globalInfo()
public Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(String[] options) throws Exception
-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)
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsException
- if an option is not supportedpublic void setLookupCacheSize(int size)
size
- the maximum size of the hashtablepublic int getLookupCacheSize()
public String lookupCacheSizeTipText()
public String startSetTipText()
public void setStartSet(String startSet) throws Exception
setStartSet
in interface StartSetHandler
startSet
- a string containing a list of attributes (and or ranges),
eg. 1,2,6,10-15.Exception
- if start set can't be set.public String getStartSet()
getStartSet
in interface StartSetHandler
public String searchTerminationTipText()
public void setSearchTermination(int t) throws Exception
t
- the number of non-improving nodesException
- if t is less than 1public int getSearchTermination()
public String directionTipText()
public void setDirection(SelectedTag d)
d
- the direction of the searchpublic SelectedTag getDirection()
public String[] getOptions()
getOptions
in interface OptionHandler
public String toString()
protected void printGroup(BitSet tt, int numAttribs)
public int[] search(ASEvaluation ASEval, Instances data) throws Exception
protected void resetOptions()
protected int[] attributeList(BitSet group)
group
- the BitSet to convertpublic String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class ASSearch
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.