public class GreedyStepwise extends ASSearch implements RankedOutputSearch, StartSetHandler, OptionHandler
-C Use conservative forward search
-B Use a backward search instead of a forward one.
-P <start set> Specify a starting set of attributes. Eg. 1,3,5-7.
-R Produce a ranked list of attributes.
-T <threshold> Specify a theshold by which attributes may be discarded from the ranking. Use in conjuction with -R
-N <num to select> Specify number of attributes to select
Modifier and Type | Field and Description |
---|---|
protected ASEvaluation |
m_ASEval |
protected boolean |
m_backward
Use a backwards search instead of a forwards one
|
protected BitSet |
m_best_group
the best subset found
|
protected double |
m_bestMerit
the merit of the best subset found
|
protected int |
m_calculatedNumToSelect |
protected int |
m_classIndex
holds the class index
|
protected boolean |
m_conservativeSelection
If set then attributes will continue to be added during a forward
search as long as the merit does not degrade
|
protected boolean |
m_doneRanking
used to indicate whether or not ranking has been performed
|
protected boolean |
m_doRank
go from one side of the search space to the other in order to generate
a ranking
|
protected boolean |
m_hasClass
does the data have a class
|
protected Instances |
m_Instances |
protected int |
m_numAttribs
number of attributes in the data
|
protected int |
m_numToSelect
The number of attributes to select.
|
protected double[][] |
m_rankedAtts
a ranked list of attribute indexes
|
protected int |
m_rankedSoFar |
protected boolean |
m_rankingRequested
true if the user has requested a ranked list of attributes
|
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 double |
m_threshold
A threshold by which to discard attributes---used by the
AttributeSelection module
|
Constructor and Description |
---|
GreedyStepwise()
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected int[] |
attributeList(BitSet group)
converts a BitSet into a list of attribute indexes
|
String |
conservativeForwardSelectionTipText()
Returns the tip text for this property
|
String |
generateRankingTipText()
Returns the tip text for this property
|
int |
getCalculatedNumToSelect()
Gets the calculated number of attributes to retain.
|
boolean |
getConservativeForwardSelection()
Gets whether conservative selection has been enabled
|
boolean |
getGenerateRanking()
Gets whether ranking has been requested.
|
int |
getNumToSelect()
Gets the number of attributes to be retained.
|
String[] |
getOptions()
Gets the current settings of ReliefFAttributeEval.
|
String |
getRevision()
Returns the revision string.
|
boolean |
getSearchBackwards()
Get whether to search backwards
|
String |
getStartSet()
Returns a list of attributes (and or attribute ranges) as a String
|
double |
getThreshold()
Returns the threshold so that the AttributeSelection module can
discard attributes from the ranking.
|
String |
globalInfo()
Returns a string describing this search method
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
String |
numToSelectTipText()
Returns the tip text for this property
|
double[][] |
rankedAttributes()
Produces a ranked list of attributes.
|
protected void |
resetOptions()
Resets options
|
int[] |
search(ASEvaluation ASEval,
Instances data)
Searches the attribute subset space by forward selection.
|
String |
searchBackwardsTipText()
Returns the tip text for this property
|
void |
setConservativeForwardSelection(boolean c)
Set whether attributes should continue to be added during
a forward search as long as merit does not decrease
|
void |
setGenerateRanking(boolean doRank)
Records whether the user has requested a ranked list of attributes.
|
void |
setNumToSelect(int n)
Specify the number of attributes to select from the ranked list
(if generating a ranking).
|
void |
setOptions(String[] options)
Parses a given list of options.
|
void |
setSearchBackwards(boolean back)
Set whether to search backwards instead of forwards
|
void |
setStartSet(String startSet)
Sets a starting set of attributes for the search.
|
void |
setThreshold(double threshold)
Set the threshold by which the AttributeSelection module can discard
attributes.
|
String |
startSetTipText()
Returns the tip text for this property
|
protected String |
startSetToString()
converts the array of starting attributes to a string.
|
String |
thresholdTipText()
Returns the tip text for this property
|
String |
toString()
returns a description of the search.
|
forName, makeCopies
protected boolean m_hasClass
protected int m_classIndex
protected int m_numAttribs
protected boolean m_rankingRequested
protected boolean m_doRank
protected boolean m_doneRanking
protected double m_threshold
protected int m_numToSelect
protected int m_calculatedNumToSelect
protected double m_bestMerit
protected double[][] m_rankedAtts
protected int m_rankedSoFar
protected BitSet m_best_group
protected ASEvaluation m_ASEval
protected Instances m_Instances
protected Range m_startRange
protected int[] m_starting
protected boolean m_backward
protected boolean m_conservativeSelection
public String globalInfo()
public String searchBackwardsTipText()
public void setSearchBackwards(boolean back)
back
- true to search backwardspublic boolean getSearchBackwards()
public String thresholdTipText()
public void setThreshold(double threshold)
setThreshold
in interface RankedOutputSearch
threshold
- the threshold.public double getThreshold()
getThreshold
in interface RankedOutputSearch
public String numToSelectTipText()
public void setNumToSelect(int n)
setNumToSelect
in interface RankedOutputSearch
n
- the number of attributes to retainpublic int getNumToSelect()
getNumToSelect
in interface RankedOutputSearch
public int getCalculatedNumToSelect()
getCalculatedNumToSelect
in interface RankedOutputSearch
public String generateRankingTipText()
public void setGenerateRanking(boolean doRank)
setGenerateRanking
in interface RankedOutputSearch
doRank
- true if ranking is requestedpublic boolean getGenerateRanking()
getGenerateRanking
in interface RankedOutputSearch
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 conservativeForwardSelectionTipText()
public void setConservativeForwardSelection(boolean c)
c
- true if atts should continue to be attedpublic boolean getConservativeForwardSelection()
public Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(String[] options) throws Exception
-C Use conservative forward search
-B Use a backward search instead of a forward one.
-P <start set> Specify a starting set of attributes. Eg. 1,3,5-7.
-R Produce a ranked list of attributes.
-T <threshold> Specify a theshold by which attributes may be discarded from the ranking. Use in conjuction with -R
-N <num to select> Specify number of attributes to select
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsException
- if an option is not supportedpublic String[] getOptions()
getOptions
in interface OptionHandler
protected String startSetToString()
public String toString()
public int[] search(ASEvaluation ASEval, Instances data) throws Exception
public double[][] rankedAttributes() throws Exception
rankedAttributes
in interface RankedOutputSearch
Exception
- if something goes wrong.protected int[] attributeList(BitSet group)
group
- the BitSet to convertprotected void resetOptions()
public String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class ASSearch
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.