public class AttributeSelection extends java.lang.Object implements java.io.Serializable, RevisionHandler
public static void main(String[] args) { runEvaluator(new FunkyEvaluator(), args); }------------------------------------------------------------------------
Constructor and Description |
---|
AttributeSelection()
constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
CrossValidateAttributes()
Perform a cross validation for attribute selection.
|
java.lang.String |
CVResultsString()
returns a string summarizing the results of repeated attribute selection
runs on splits of a dataset.
|
java.lang.String |
getRevision()
Returns the revision string.
|
static void |
main(java.lang.String[] args)
Main method for testing this class.
|
int |
numberAttributesSelected()
Return the number of attributes selected from the most recent run of
attribute selection
|
double[][] |
rankedAttributes()
get the final ranking of the attributes.
|
Instance |
reduceDimensionality(Instance in)
reduce the dimensionality of a single instance to include only those
attributes chosen by the last run of attribute selection.
|
Instances |
reduceDimensionality(Instances in)
reduce the dimensionality of a set of instances to include only those
attributes chosen by the last run of attribute selection.
|
static java.lang.String |
SelectAttributes(ASEvaluation ASEvaluator,
java.lang.String[] options)
Perform attribute selection with a particular evaluator and a set of
options specifying search method and input file etc.
|
static java.lang.String |
SelectAttributes(ASEvaluation ASEvaluator,
java.lang.String[] options,
Instances train)
Perform attribute selection with a particular evaluator and a set of
options specifying search method and options for the search method and
evaluator.
|
void |
SelectAttributes(Instances data)
Perform attribute selection on the supplied training instances.
|
void |
selectAttributesCVSplit(Instances split)
Select attributes for a split of the data.
|
int[] |
selectedAttributes()
get the final selected set of attributes.
|
void |
setEvaluator(ASEvaluation evaluator)
set the attribute/subset evaluator
|
void |
setFolds(int folds)
set the number of folds for cross validation
|
void |
setRanking(boolean r)
produce a ranking (if possible with the set search and evaluator)
|
void |
setSearch(ASSearch search)
set the search method
|
void |
setSeed(int s)
set the seed for use in cross validation
|
void |
setXval(boolean x)
do a cross validation
|
java.lang.String |
toResultsString()
get a description of the attribute selection
|
void |
updateStatsForModelCVSplit(Instances split,
ASEvaluation evaluator,
ASSearch search,
int[] attributeSet,
boolean doRank)
Update the attribute selection stats for a cross-validation fold of the
data.
|
public AttributeSelection()
public int numberAttributesSelected() throws java.lang.Exception
java.lang.Exception
public int[] selectedAttributes() throws java.lang.Exception
java.lang.Exception
- if attribute selection has not been performed yetpublic double[][] rankedAttributes() throws java.lang.Exception
java.lang.Exception
- if a ranking has not been producedpublic void setEvaluator(ASEvaluation evaluator)
evaluator
- the evaluator to usepublic void setSearch(ASSearch search)
search
- the search method to usepublic void setFolds(int folds)
folds
- the number of foldspublic void setRanking(boolean r)
r
- true if a ranking is to be producedpublic void setXval(boolean x)
x
- true if a cross validation is to be performedpublic void setSeed(int s)
s
- the seedpublic java.lang.String toResultsString()
public Instances reduceDimensionality(Instances in) throws java.lang.Exception
in
- the instances to be reducedjava.lang.Exception
- if the instances can't be reducedpublic Instance reduceDimensionality(Instance in) throws java.lang.Exception
in
- the instance to be reducedjava.lang.Exception
- if the instance can't be reducedpublic static java.lang.String SelectAttributes(ASEvaluation ASEvaluator, java.lang.String[] options) throws java.lang.Exception
ASEvaluator
- an evaluator objectoptions
- an array of options, not only for the evaluator but also the
search method (if any) and an input data filejava.lang.Exception
- if no training file is setpublic java.lang.String CVResultsString() throws java.lang.Exception
java.lang.Exception
- if no attribute selection has been performed.public void selectAttributesCVSplit(Instances split) throws java.lang.Exception
split
- the instances to select attributes fromjava.lang.Exception
- if an error occurspublic void updateStatsForModelCVSplit(Instances split, ASEvaluation evaluator, ASSearch search, int[] attributeSet, boolean doRank) throws java.lang.Exception
split
- the instances in this split/fold of the dataevaluator
- the evaluator that was usedsearch
- the search that was usedattributeSet
- the final subset produced for the splitdoRank
- whether to produce a rankingjava.lang.Exception
- if a problem occurspublic java.lang.String CrossValidateAttributes() throws java.lang.Exception
java.lang.Exception
- if an error occurs during cross validationpublic void SelectAttributes(Instances data) throws java.lang.Exception
data
- the instances to select attributes fromjava.lang.Exception
- if there is a problem during selectionpublic static java.lang.String SelectAttributes(ASEvaluation ASEvaluator, java.lang.String[] options, Instances train) throws java.lang.Exception
ASEvaluator
- an evaluator objectoptions
- an array of options, not only for the evaluator but also the
search method (if any) and an input data filetrain
- the input instancesjava.lang.Exception
- if incorrect options are suppliedpublic static void main(java.lang.String[] args)
args
- the optionspublic java.lang.String getRevision()
getRevision
in interface RevisionHandler