Package weka.attributeSelection
Class LinearForwardSelection
- java.lang.Object
-
- weka.attributeSelection.ASSearch
-
- weka.attributeSelection.LinearForwardSelection
-
- All Implemented Interfaces:
java.io.Serializable
,StartSetHandler
,OptionHandler
,RevisionHandler
,TechnicalInformationHandler
public class LinearForwardSelection extends ASSearch implements OptionHandler, StartSetHandler, TechnicalInformationHandler
LinearForwardSelection:
Extension of BestFirst. Takes a restricted number of k attributes into account. Fixed-set selects a fixed number k of attributes, whereas k is increased in each step when fixed-width is selected. The search uses either the initial ordering to select the top k attributes, or performs a ranking (with the same evalutator the search uses later on). The search direction can be forward, or floating forward selection (with opitional backward search steps).
For more information see:
Martin Guetlein (2006). Large Scale Attribute Selection Using Wrappers. Freiburg, Germany. Valid options are:-P <start set> Specify a starting set of attributes. Eg. 1,3,5-7.
-D <0 = forward selection | 1 = floating forward selection> Forward selection method. (default = 0).
-N <num> Number of non-improving nodes to consider before terminating search.
-I Perform initial ranking to select the top-ranked attributes.
-K <num> Number of top-ranked attributes that are taken into account by the search.
-T <0 = fixed-set | 1 = fixed-width> Type of Linear Forward Selection (default = 0).
-S <num> Size of lookup cache for evaluated subsets. Expressed as a multiple of the number of attributes in the data set. (default = 1)
-Z verbose on/off
- Version:
- $Revision: 6161 $
- Author:
- Martin Guetlein (martin.guetlein@gmail.com)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Tag[]
TAGS_SEARCH_METHOD
static Tag[]
TAGS_TYPE
-
Constructor Summary
Constructors Constructor Description LinearForwardSelection()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
forwardSelectionMethodTipText()
Returns the tip text for this propertySelectedTag
getForwardSelectionMethod()
Get the search directionint
getLookupCacheSize()
Return the maximum size of the evaluated subset cache (expressed as a multiplier for the number of attributes in a data set.int
getNumUsedAttributes()
Get the number of top-ranked attributes that taken into account by the search process.java.lang.String[]
getOptions()
Gets the current settings of LinearForwardSelection.boolean
getPerformRanking()
Get boolean if initial ranking should be performed to select the top-ranked attributesjava.lang.String
getRevision()
Returns the revision string.int
getSearchTermination()
Get the termination criterion (number of non-improving nodes).java.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.SelectedTag
getType()
Get the typeboolean
getVerbose()
Get whether output is to be verbosejava.lang.String
globalInfo()
Returns a string describing this search methodjava.util.Enumeration
listOptions()
Returns an enumeration describing the available options.java.lang.String
lookupCacheSizeTipText()
Returns the tip text for this propertyjava.lang.String
numUsedAttributesTipText()
Returns the tip text for this propertyjava.lang.String
performRankingTipText()
Returns the tip text for this propertyint[]
search(ASEvaluation ASEval, Instances data)
Searches the attribute subset space by linear forward selectionjava.lang.String
searchTerminationTipText()
Returns the tip text for this propertyvoid
setForwardSelectionMethod(SelectedTag d)
Set the search directionvoid
setLookupCacheSize(int size)
Set the maximum size of the evaluated subset cache (hashtable).void
setNumUsedAttributes(int k)
Set the number of top-ranked attributes that taken into account by the search process.void
setOptions(java.lang.String[] options)
Parses a given list of options.void
setPerformRanking(boolean b)
Perform initial ranking to select top-ranked attributes.void
setSearchTermination(int t)
Set the numnber of non-improving nodes to consider before terminating search.void
setStartSet(java.lang.String startSet)
Sets a starting set of attributes for the search.void
setType(SelectedTag t)
Set the typevoid
setVerbose(boolean b)
Set whether verbose output should be generated.java.lang.String
startSetTipText()
Returns the tip text for this propertyjava.lang.String
toString()
returns a description of the search as a Stringjava.lang.String
typeTipText()
Returns the tip text for this propertyjava.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 method 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
Specify a starting set of attributes. Eg 1,4,7-9.-D <0 = forward selection | 1 = floating forward selection>
Forward selection method of the search. (default = 0).-N
Number of non improving nodes to consider before terminating search. (default = 5).-I
Perform initial ranking to select top-ranked attributes.-K
Number of top-ranked attributes that are taken into account.-T <0 = fixed-set | 1 = fixed-width>
Typ of Linear Forward Selection (default = 0).-S
Size of lookup cache for evaluated subsets. Expressed as a multiple of the number of attributes in the data set. (default = 1).-Z
verbose on/off.- 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
-
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
public java.lang.String lookupCacheSizeTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
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.- 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)
-
searchTerminationTipText
public java.lang.String searchTerminationTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setSearchTermination
public void setSearchTermination(int t) throws java.lang.Exception
Set the numnber of non-improving nodes to consider before terminating search.- Parameters:
t
- the number of non-improving nodes- Throws:
java.lang.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
-
performRankingTipText
public java.lang.String performRankingTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setPerformRanking
public void setPerformRanking(boolean b)
Perform initial ranking to select top-ranked attributes.- Parameters:
b
- true if initial ranking should be performed
-
getPerformRanking
public boolean getPerformRanking()
Get boolean if initial ranking should be performed to select the top-ranked attributes- Returns:
- true if initial ranking should be performed
-
numUsedAttributesTipText
public java.lang.String numUsedAttributesTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNumUsedAttributes
public void setNumUsedAttributes(int k) throws java.lang.Exception
Set the number of top-ranked attributes that taken into account by the search process.- Parameters:
k
- the number of attributes- Throws:
java.lang.Exception
- if k is less than 2
-
getNumUsedAttributes
public int getNumUsedAttributes()
Get the number of top-ranked attributes that taken into account by the search process.- Returns:
- the number of top-ranked attributes that taken into account
-
forwardSelectionMethodTipText
public java.lang.String forwardSelectionMethodTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setForwardSelectionMethod
public void setForwardSelectionMethod(SelectedTag d)
Set the search direction- Parameters:
d
- the direction of the search
-
getForwardSelectionMethod
public SelectedTag getForwardSelectionMethod()
Get the search direction- Returns:
- the direction of the search
-
typeTipText
public java.lang.String typeTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setType
public void setType(SelectedTag t)
Set the type- Parameters:
t
- the Linear Forward Selection type
-
getType
public SelectedTag getType()
Get the type- Returns:
- the Linear Forward Selection type
-
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 b)
Set whether verbose output should be generated.- Parameters:
d
- true if output is to be verbose.
-
getVerbose
public boolean getVerbose()
Get whether output is to be verbose- Returns:
- true if output will be verbose
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of LinearForwardSelection.- Specified by:
getOptions
in interfaceOptionHandler
- Returns:
- an array of strings suitable for passing to setOptions()
-
toString
public java.lang.String toString()
returns a description of the search as a String- Overrides:
toString
in classjava.lang.Object
- Returns:
- a description of the search
-
search
public int[] search(ASEvaluation ASEval, Instances data) throws java.lang.Exception
Searches the attribute subset space by linear forward selection
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classASSearch
- Returns:
- the revision
-
-