Package weka.attributeSelection
Class Ranker
- java.lang.Object
-
- weka.attributeSelection.ASSearch
-
- weka.attributeSelection.Ranker
-
- All Implemented Interfaces:
java.io.Serializable,RankedOutputSearch,StartSetHandler,OptionHandler,RevisionHandler
public class Ranker extends ASSearch implements RankedOutputSearch, StartSetHandler, OptionHandler
Ranker :
Ranks attributes by their individual evaluations. Use in conjunction with attribute evaluators (ReliefF, GainRatio, Entropy etc).
Valid options are:-P <start set> Specify a starting set of attributes. Eg. 1,3,5-7. Any starting attributes specified are ignored during the ranking.
-T <threshold> Specify a theshold by which attributes may be discarded from the ranking.
-N <num to select> Specify number of attributes to select
- Version:
- $Revision: 1.26 $
- Author:
- Mark Hall (mhall@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Ranker()Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgenerateRankingTipText()Returns the tip text for this propertyintgetCalculatedNumToSelect()Gets the calculated number to select.booleangetGenerateRanking()This is a dummy method.intgetNumToSelect()Gets the number of attributes to be retained.java.lang.String[]getOptions()Gets the current settings of ReliefFAttributeEval.java.lang.StringgetRevision()Returns the revision string.java.lang.StringgetStartSet()Returns a list of attributes (and or attribute ranges) as a StringdoublegetThreshold()Returns the threshold so that the AttributeSelection module can discard attributes from the ranking.java.lang.StringglobalInfo()Returns a string describing this search methodjava.util.EnumerationlistOptions()Returns an enumeration describing the available options.java.lang.StringnumToSelectTipText()Returns the tip text for this propertydouble[][]rankedAttributes()Sorts the evaluated attribute listint[]search(ASEvaluation ASEval, Instances data)Kind of a dummy search algorithm.voidsetGenerateRanking(boolean doRank)This is a dummy set method---Ranker is ONLY capable of producing a ranked list of attributes for attribute evaluators.voidsetNumToSelect(int n)Specify the number of attributes to select from the ranked list.voidsetOptions(java.lang.String[] options)Parses a given list of options.voidsetStartSet(java.lang.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.java.lang.StringstartSetTipText()Returns the tip text for this propertyjava.lang.StringthresholdTipText()Returns the tip text for this propertyjava.lang.StringtoString()returns a description of the search as a String-
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 suitable for displaying in the explorer/experimenter gui
-
numToSelectTipText
public java.lang.String numToSelectTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNumToSelect
public void setNumToSelect(int n)
Specify the number of attributes to select from the ranked list. -1 indicates that all attributes are to be retained.- Specified by:
setNumToSelectin interfaceRankedOutputSearch- Parameters:
n- the number of attributes to retain
-
getNumToSelect
public int getNumToSelect()
Gets the number of attributes to be retained.- Specified by:
getNumToSelectin interfaceRankedOutputSearch- Returns:
- the number of attributes to retain
-
getCalculatedNumToSelect
public int getCalculatedNumToSelect()
Gets the calculated number to select. This might be computed from a threshold, or if < 0 is set as the number to select then it is set to the number of attributes in the (transformed) data.- Specified by:
getCalculatedNumToSelectin interfaceRankedOutputSearch- Returns:
- the calculated number of attributes to select
-
thresholdTipText
public java.lang.String thresholdTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setThreshold
public void setThreshold(double threshold)
Set the threshold by which the AttributeSelection module can discard attributes.- Specified by:
setThresholdin interfaceRankedOutputSearch- Parameters:
threshold- the threshold.
-
getThreshold
public double getThreshold()
Returns the threshold so that the AttributeSelection module can discard attributes from the ranking.- Specified by:
getThresholdin interfaceRankedOutputSearch- Returns:
- a threshold by which to discard attributes
-
generateRankingTipText
public java.lang.String generateRankingTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setGenerateRanking
public void setGenerateRanking(boolean doRank)
This is a dummy set method---Ranker is ONLY capable of producing a ranked list of attributes for attribute evaluators.- Specified by:
setGenerateRankingin interfaceRankedOutputSearch- Parameters:
doRank- this parameter is N/A and is ignored
-
getGenerateRanking
public boolean getGenerateRanking()
This is a dummy method. Ranker can ONLY be used with attribute evaluators and as such can only produce a ranked list of attributes- Specified by:
getGenerateRankingin interfaceRankedOutputSearch- Returns:
- true all the time.
-
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.ExceptionSets 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 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:
getStartSetin interfaceStartSetHandler- Returns:
- a list of attributes (and or attribute ranges)
-
listOptions
public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.ExceptionParses a given list of options. Valid options are:-P <start set> Specify a starting set of attributes. Eg. 1,3,5-7. Any starting attributes specified are ignored during the ranking.
-T <threshold> Specify a theshold by which attributes may be discarded from the ranking.
-N <num to select> Specify number of attributes to select
- Specified by:
setOptionsin interfaceOptionHandler- Parameters:
options- the list of options as an array of strings- Throws:
java.lang.Exception- if an option is not supported
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of ReliefFAttributeEval.- Specified by:
getOptionsin interfaceOptionHandler- Returns:
- an array of strings suitable for passing to setOptions()
-
search
public int[] search(ASEvaluation ASEval, Instances data) throws java.lang.Exception
Kind of a dummy search algorithm. Calls a Attribute evaluator to evaluate each attribute not included in the startSet and then sorts them to produce a ranked list of attributes.
-
rankedAttributes
public double[][] rankedAttributes() throws java.lang.ExceptionSorts the evaluated attribute list- Specified by:
rankedAttributesin interfaceRankedOutputSearch- Returns:
- an array of sorted (highest eval to lowest) attribute indexes
- Throws:
java.lang.Exception- of sorting can't be done.
-
toString
public java.lang.String toString()
returns a description of the search as a String- Overrides:
toStringin classjava.lang.Object- Returns:
- a description of the search
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classASSearch- Returns:
- the revision
-
-