Package weka.attributeSelection
Class GreedyStepwise
java.lang.Object
weka.attributeSelection.ASSearch
weka.attributeSelection.GreedyStepwise
- All Implemented Interfaces:
- Serializable,- RankedOutputSearch,- StartSetHandler,- OptionHandler,- RevisionHandler
public class GreedyStepwise
extends ASSearch
implements RankedOutputSearch, StartSetHandler, OptionHandler
 GreedyStepwise :
 
Performs a greedy forward or backward search through the space of attribute subsets. May start with no/all attributes or from an arbitrary point in the space. Stops when the addition/deletion of any remaining attributes results in a decrease in evaluation. Can also produce a ranked list of attributes by traversing the space from one side to the other and recording the order that attributes are selected.
Valid options are:
Performs a greedy forward or backward search through the space of attribute subsets. May start with no/all attributes or from an arbitrary point in the space. Stops when the addition/deletion of any remaining attributes results in a decrease in evaluation. Can also produce a ranked list of attributes by traversing the space from one side to the other and recording the order that attributes are selected.
Valid options are:
-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
-num-slots <int> The number of execution slots, for example, the number of cores in the CPU. (default 1)
-D Print debugging output
- Version:
- $Revision: 15519 $
- Author:
- Mark Hall
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionReturns the tip text for this propertyReturns the tip text for this propertyReturns the tip text for this propertyintGets the calculated number of attributes to retain.booleanGets whether conservative selection has been enabledbooleanGet whether to output debugging info to the consolebooleanGets whether ranking has been requested.intGets the number of threads.intGets the number of attributes to be retained.String[]Gets the current settings of ReliefFAttributeEval.Returns the revision string.booleanGet whether to search backwardsReturns a list of attributes (and or attribute ranges) as a StringdoubleReturns the threshold so that the AttributeSelection module can discard attributes from the ranking.Returns a string describing this search methodReturns an enumeration describing the available options.Returns the tip text for this propertydouble[][]Produces a ranked list of attributes.int[]search(ASEvaluation ASEval, Instances data) Searches the attribute subset space by forward selection.Returns the tip text for this propertyvoidsetConservativeForwardSelection(boolean c) Set whether attributes should continue to be added during a forward search as long as merit does not decreasevoidsetDebuggingOutput(boolean d) Set whether to output debugging info to the consolevoidsetGenerateRanking(boolean doRank) Records whether the user has requested a ranked list of attributes.voidsetNumExecutionSlots(int nT) Sets the number of threadsvoidsetNumToSelect(int n) Specify the number of attributes to select from the ranked list (if generating a ranking).voidsetOptions(String[] options) Parses a given list of options.voidsetSearchBackwards(boolean back) Set whether to search backwards instead of forwardsvoidsetStartSet(String startSet) Sets a starting set of attributes for the search.voidsetThreshold(double threshold) Set the threshold by which the AttributeSelection module can discard attributes.Returns the tip text for this propertyReturns the tip text for this propertytoString()returns a description of the search.Methods inherited from class weka.attributeSelection.ASSearchforName, makeCopies
- 
Constructor Details- 
GreedyStepwisepublic GreedyStepwise()Constructor
 
- 
- 
Method Details- 
globalInfoReturns a string describing this search method- Returns:
- a description of the search suitable for displaying in the explorer/experimenter gui
 
- 
searchBackwardsTipTextReturns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
 
- 
setSearchBackwardspublic void setSearchBackwards(boolean back) Set whether to search backwards instead of forwards- Parameters:
- back- true to search backwards
 
- 
getSearchBackwardspublic boolean getSearchBackwards()Get whether to search backwards- Returns:
- true if the search will proceed backwards
 
- 
thresholdTipTextReturns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
 
- 
setThresholdpublic void setThreshold(double threshold) Set the threshold by which the AttributeSelection module can discard attributes.- Specified by:
- setThresholdin interface- RankedOutputSearch
- Parameters:
- threshold- the threshold.
 
- 
getThresholdpublic double getThreshold()Returns the threshold so that the AttributeSelection module can discard attributes from the ranking.- Specified by:
- getThresholdin interface- RankedOutputSearch
- Returns:
- a threshold by which to discard attributes
 
- 
numToSelectTipTextReturns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
 
- 
setNumToSelectpublic void setNumToSelect(int n) Specify the number of attributes to select from the ranked list (if generating a ranking). -1 indicates that all attributes are to be retained.- Specified by:
- setNumToSelectin interface- RankedOutputSearch
- Parameters:
- n- the number of attributes to retain
 
- 
getNumToSelectpublic int getNumToSelect()Gets the number of attributes to be retained.- Specified by:
- getNumToSelectin interface- RankedOutputSearch
- Returns:
- the number of attributes to retain
 
- 
getCalculatedNumToSelectpublic int getCalculatedNumToSelect()Gets the calculated number of attributes to retain. This is the actual number of attributes to retain. This is the same as getNumToSelect if the user specifies a number which is not less than zero. Otherwise it should be the number of attributes in the (potentially transformed) data.- Specified by:
- getCalculatedNumToSelectin interface- RankedOutputSearch
 
- 
generateRankingTipTextReturns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
 
- 
setGenerateRankingpublic void setGenerateRanking(boolean doRank) Records whether the user has requested a ranked list of attributes.- Specified by:
- setGenerateRankingin interface- RankedOutputSearch
- Parameters:
- doRank- true if ranking is requested
 
- 
getGenerateRankingpublic boolean getGenerateRanking()Gets whether ranking has been requested. This is used by the AttributeSelection module to determine if rankedAttributes() should be called.- Specified by:
- getGenerateRankingin interface- RankedOutputSearch
- Returns:
- true if ranking has been requested.
 
- 
startSetTipTextReturns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
 
- 
setStartSetSets 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:
- setStartSetin interface- StartSetHandler
- 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.
 
- 
getStartSetReturns a list of attributes (and or attribute ranges) as a String- Specified by:
- getStartSetin interface- StartSetHandler
- Returns:
- a list of attributes (and or attribute ranges)
 
- 
conservativeForwardSelectionTipTextReturns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
 
- 
setConservativeForwardSelectionpublic void setConservativeForwardSelection(boolean c) Set whether attributes should continue to be added during a forward search as long as merit does not decrease- Parameters:
- c- true if atts should continue to be atted
 
- 
getConservativeForwardSelectionpublic boolean getConservativeForwardSelection()Gets whether conservative selection has been enabled- Returns:
- true if conservative forward selection is enabled
 
- 
debuggingOutputTipTextReturns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
 
- 
setDebuggingOutputpublic void setDebuggingOutput(boolean d) Set whether to output debugging info to the console- Parameters:
- d- true if dubugging info is to be output
 
- 
getDebuggingOutputpublic boolean getDebuggingOutput()Get whether to output debugging info to the console- Returns:
- true if dubugging info is to be output
 
- 
numExecutionSlotsTipText- Returns:
- a string to describe the option
 
- 
getNumExecutionSlotspublic int getNumExecutionSlots()Gets the number of threads.
- 
setNumExecutionSlotspublic void setNumExecutionSlots(int nT) Sets the number of threads
- 
listOptionsReturns an enumeration describing the available options.- Specified by:
- listOptionsin interface- OptionHandler
- Overrides:
- listOptionsin class- ASSearch
- Returns:
- an enumeration of all the available options.
 
- 
setOptionsParses a given list of options. Valid options are:-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 -num-slots <int> The number of execution slots, for example, the number of cores in the CPU. (default 1) -D Print debugging output - Specified by:
- setOptionsin interface- OptionHandler
- Overrides:
- setOptionsin class- ASSearch
- Parameters:
- options- the list of options as an array of strings
- Throws:
- Exception- if an option is not supported
 
- 
getOptionsGets the current settings of ReliefFAttributeEval.- Specified by:
- getOptionsin interface- OptionHandler
- Overrides:
- getOptionsin class- ASSearch
- Returns:
- an array of strings suitable for passing to setOptions()
 
- 
toStringreturns a description of the search.
- 
searchSearches the attribute subset space by forward selection.
- 
rankedAttributesProduces a ranked list of attributes. Search must have been performed prior to calling this function. Search is called by this function to complete the traversal of the the search space. A list of attributes and merits are returned. The attributes a ranked by the order they are added to the subset during a forward selection search. Individual merit values reflect the merit associated with adding the corresponding attribute to the subset; because of this, merit values may initially increase but then decrease as the best subset is "passed by" on the way to the far side of the search space.- Specified by:
- rankedAttributesin interface- RankedOutputSearch
- Returns:
- an array of attribute indexes and associated merit values
- Throws:
- Exception- if something goes wrong.
 
- 
getRevisionReturns the revision string.- Specified by:
- getRevisionin interface- RevisionHandler
- Overrides:
- getRevisionin class- ASSearch
- Returns:
- the revision
 
 
-