All Packages Class Hierarchy This Package Previous Next Index WEKA's home
java.lang.Object | +----weka.attributeSelection.AttributeSelection
Valid options are:
-h
Display help.
-I
-C
-S
-X
-N
------------------------------------------------------------------------
Example usage as the main of an attribute evaluator (called FunkyEvaluator):
------------------------------------------------------------------------
Specify the training arff file.
The index of the attribute to use as the class.
The full class name of the search method followed by search method options
(if any).
Eg. -S "weka.attributeSelection.BestFirst -N 10"
Perform a cross validation.
Specify a random number seed. Use in conjuction with -X. (Default = 1).
public static void main(String [] args) {
try {
ASEvaluator eval = new FunkyEvaluator();
System.out.println(SelectAttributes(Evaluator, args));
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
AttributeSelection()
CrossValidateAttributes()
CVResultsString()
main(String[])
numberAttributesSelected()
rankedAttributes()
reduceDimensionality(Instance)
reduceDimensionality(Instances)
SelectAttributes(ASEvaluation, String[])
SelectAttributes(ASEvaluation, String[], Instances)
SelectAttributes(Instances)
selectAttributesCVSplit(Instances)
selectedAttributes()
setEvaluator(ASEvaluation)
setFolds(int)
setRanking(boolean)
setSearch(ASSearch)
setSeed(int)
setThreshold(double)
setXval(boolean)
toResultsString()
AttributeSelection
public AttributeSelection()
constructor. Sets defaults for each member varaible. Default
attribute evaluator is CfsSubsetEval; default search method is
BestFirst.
numberAttributesSelected
public int numberAttributesSelected() throws java.lang.Exception
Return the number of attributes selected from the most recent
run of attribute selection
selectedAttributes
public int[] selectedAttributes() throws java.lang.Exception
get the final selected set of attributes.
rankedAttributes
public double[][] rankedAttributes() throws java.lang.Exception
get the final ranking of the attributes.
setEvaluator
public void setEvaluator(ASEvaluation evaluator)
set the attribute/subset evaluator
evaluator
- the evaluator to use
setSearch
public void setSearch(ASSearch search)
set the search method
search
- the search method to use
setFolds
public void setFolds(int folds)
set the number of folds for cross validation
folds
- the number of folds
setRanking
public void setRanking(boolean r)
produce a ranking (if possible with the set search and evaluator)
r
- true if a ranking is to be produced
setXval
public void setXval(boolean x)
do a cross validation
x
- true if a cross validation is to be performed
setSeed
public void setSeed(int s)
set the seed for use in cross validation
s
- the seed
setThreshold
public void setThreshold(double t)
set the threshold by which to select features from a ranked list
t
- the threshold
toResultsString
public java.lang.String toResultsString()
get a description of the attribute selection
reduceDimensionality
public Instances reduceDimensionality(Instances in) throws java.lang.Exception
reduce the dimensionality of a set of instances to include only those
attributes chosen by the last run of attribute selection.
in
- the instances to be reduced
reduceDimensionality
public Instance reduceDimensionality(Instance in) throws java.lang.Exception
reduce the dimensionality of a single instance to include only those
attributes chosen by the last run of attribute selection.
in
- the instance to be reduced
SelectAttributes
public static java.lang.String SelectAttributes(ASEvaluation ASEvaluator,
java.lang.String options[]) throws java.lang.Exception
Perform attribute selection with a particular evaluator and
a set of options specifying search method and input file etc.
ASEvaluator
- an evaluator object
options
- an array of options, not only for the evaluator
but also the search method (if any) and an input data file
CVResultsString
public java.lang.String CVResultsString() throws java.lang.Exception
returns a string summarizing the results of repeated attribute
selection runs on splits of a dataset.
selectAttributesCVSplit
public void selectAttributesCVSplit(Instances split) throws java.lang.Exception
Select attributes for a split of the data. Calling this function
updates the statistics on attribute selection. CVResultsString()
returns a string summarizing the results of repeated calls to
this function. Assumes that splits are from the same dataset---
ie. have the same number and types of attributes as previous
splits.
split
- the instances to select attributes from
CrossValidateAttributes
public java.lang.String CrossValidateAttributes() throws java.lang.Exception
Perform a cross validation for attribute selection. With subset
evaluators the number of times each attribute is selected over
the cross validation is reported. For attribute evaluators, the
average merit and average ranking + std deviation is reported for
each attribute.
SelectAttributes
public void SelectAttributes(Instances data) throws java.lang.Exception
Perform attribute selection on the supplied training instances.
data
- the instances to select attributes from
SelectAttributes
public static java.lang.String SelectAttributes(ASEvaluation ASEvaluator,
java.lang.String options[],
Instances train) throws java.lang.Exception
Perform attribute selection with a particular evaluator and
a set of options specifying search method and options for the
search method and evaluator.
ASEvaluator
- an evaluator object
options
- an array of options, not only for the evaluator
but also the search method (if any) and an input data file
outAttributes
- index 0 will contain the array of selected
attribute indices
train
- the input instances
main
public static void main(java.lang.String args[])
Main method for testing this class.
args
- the options
All Packages Class Hierarchy This Package Previous Next Index WEKA's home