public class IWSS
extends weka.attributeSelection.ASSearch
implements weka.core.OptionHandler, weka.attributeSelection.StartSetHandler, weka.core.TechnicalInformationHandler
Modifier and Type | Field and Description |
---|---|
protected double[] |
m_bestGoodness
Array which keeps the best cross-validation so far in the incremental
search
|
protected weka.core.Instances |
m_dataset
The dataset
|
protected int |
m_formerSelected
Number of former attributes in ranking to be straight-forward selected
before running the incremental search.
|
protected int |
m_minFolds
Minimum number of folds in inner cross-validation whose wrapper goodness
must be improved when selecting a new attribute.
|
protected static int |
m_numFolds
Number of folds in the inner cross-validation
|
protected int |
m_numSelected
Number of selected attributes (first in ranking is selected by default)
|
protected weka.attributeSelection.ASEvaluation |
m_rankingMetric
Single Attribute evaluator used to create the ranking
|
protected boolean |
m_replaceSelection
Flag to activate the option of testing, at each step of the incremental
search, the swapping of a selected feature with another not selected yet.
|
protected java.util.ArrayList<java.lang.Integer> |
m_selected
Selected attributes
|
protected boolean |
m_skipRanking
It is set to true if IWSS.setStartSet is called
|
protected java.util.ArrayList<weka.core.Instances> |
m_testData
The test set for inner cross validation
|
protected double |
m_theta
Value for early stopping: (0-1] percentage of remaining attributes to
visit.
|
protected java.util.ArrayList<weka.core.Instances> |
m_trainingData
The training set for inner cross validation
|
private static long |
serialVersionUID |
Constructor and Description |
---|
IWSS()
The constructor
|
Modifier and Type | Method and Description |
---|---|
protected int |
computeWrapperGoodness(double[] storeGoodness,
weka.classifiers.Classifier tempClassifier,
weka.core.SelectedTag eval_tag)
weka.classifiers.Evaluation cannot be used because IWSS needs to keep
track of the wrapper goodness for each fold of the inner cross
validation.
|
protected int[] |
doRanking() |
private double |
getGoodness(weka.classifiers.Evaluation eval,
weka.core.SelectedTag eval_tag)
Get the goodness of a given classifier over the passed data set
|
int |
getMinFolds() |
java.lang.String[] |
getOptions()
get a String[] describing the value set for all options
|
private weka.core.Instances |
getProjection(weka.core.Instances data,
java.util.ArrayList<java.lang.Integer> subset)
Projects the given dataset over the passed attributes and class
|
int[] |
getRanking(weka.core.Instances data)
Ranks attributes based on a bivariated (X;Class) metric set in
m_rankingMetric
|
weka.attributeSelection.ASEvaluation |
getRankingMetric() |
protected java.lang.String |
getRankingMetricSpec()
Gets the evaluator specification string, which contains the class name of
the attribute evaluator and any options to it
|
boolean |
getReplaceSelection() |
int[] |
getSelected() |
java.lang.String |
getStartSet() |
weka.core.TechnicalInformation |
getTechnicalInformation() |
double |
getTheta() |
java.lang.String |
globalInfo()
Returns a string describing this search algorithm
|
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
java.lang.String |
minFoldsTipText()
Returns the tip text for this property
|
protected void |
prepareFolds(int seed)
Prepares train and test data for evaluation and counting how many folds
get higher wrapper goodness than folds of evaluation with the up to now
best features subset.
|
java.lang.String |
rankingMetricTipText()
Returns the tip text for this property
|
java.lang.String |
replaceSelectionTipText() |
void |
resetOptions()
Reset all options to their default values
|
protected void |
runIWSS(int toVisit,
int[] ranking,
weka.attributeSelection.ASEvaluation ASEvaluator) |
protected void |
runIWSSreplace(int toVisit,
int[] ranking,
weka.attributeSelection.ASEvaluation ASEvaluator) |
int[] |
search(weka.attributeSelection.ASEvaluation ASEvaluator,
weka.core.Instances data)
Performs an incremental wrapper subset selection, as described in the
referenced paper, over a filter-ranking.
|
void |
setMinFolds(int mf) |
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setRankingMetric(weka.attributeSelection.ASEvaluation AE) |
void |
setReplaceSelection(boolean r)
Activate the option of testing, at each step of the incremental search, the swapping of
a selected feature with another not selected yet.
|
void |
setStartSet(java.lang.String set)
Setting a start set instancies m_skipRanking=true.
|
void |
setTheta(double t) |
java.lang.String |
thetaTipText()
Returns the tip text for this property
|
java.lang.String |
toString() |
private static final long serialVersionUID
protected int m_minFolds
protected weka.attributeSelection.ASEvaluation m_rankingMetric
protected double m_theta
protected boolean m_replaceSelection
protected java.util.ArrayList<weka.core.Instances> m_trainingData
protected java.util.ArrayList<weka.core.Instances> m_testData
protected double[] m_bestGoodness
protected weka.core.Instances m_dataset
protected java.util.ArrayList<java.lang.Integer> m_selected
protected int m_numSelected
protected int m_formerSelected
protected boolean m_skipRanking
protected static int m_numFolds
public IWSS() throws java.lang.Exception
data
- Instances object to initiate global object datasetjava.lang.Exception
public void resetOptions()
public int[] getRanking(weka.core.Instances data) throws java.lang.Exception
data
- Instances with attributes to rankif
- something goes wrong during rankingjava.lang.Exception
public boolean getReplaceSelection()
protected void prepareFolds(int seed)
private double getGoodness(weka.classifiers.Evaluation eval, weka.core.SelectedTag eval_tag) throws java.lang.Exception
java.lang.Exception
private weka.core.Instances getProjection(weka.core.Instances data, java.util.ArrayList<java.lang.Integer> subset) throws java.lang.Exception
data
- Instances object to projectsubset
- List of attributes to keep in projection. Class is
automatically addedjava.lang.Exception
public int[] getSelected()
public java.util.Enumeration listOptions()
listOptions
in interface weka.core.OptionHandler
public void setMinFolds(int mf)
mf
- minimum number of folds whose wrapper goodness must be
improved in the inner cross-validation when selecting a new
attribute.public java.lang.String minFoldsTipText()
public void setTheta(double t)
t
- the value to tune the early stopping procedure. Range is
(0-1]. When t=1, early stopping is turned off.public java.lang.String thetaTipText()
public void setReplaceSelection(boolean r)
r
- public java.lang.String replaceSelectionTipText()
public void setRankingMetric(weka.attributeSelection.ASEvaluation AE) throws java.lang.Exception
AE
- the attribute evaluator (X;Class) used for building the
rankingjava.lang.Exception
public java.lang.String rankingMetricTipText()
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-minFoldsminimum number of folds whose wrapper goodness must be improved in the inner cross-validation when selecting a new attribute. (default 2)
-thetathe value to tune the early stopping procedure. Range is (0-1]. When t=1, early stopping is turned off. (default 1)
-rankingMetricAttributeEvaluator to use for the creation of the ranking over which IWSS will be run. (default weka.attributeSelection.SymmetricalUncertAttributeEval)
-replaceSelection Flag to activate the option of testing, at each step of the incremental search, the swapping of a selected feature with another not selected yet. This increases the worst-case theoretical complexity from linear to quadratic.
setOptions
in interface weka.core.OptionHandler
options
- the list of options as an array of stringsAttributeEvaluator
- java.lang.Exception
- if an option is not supportedpublic int getMinFolds()
public double getTheta()
public weka.attributeSelection.ASEvaluation getRankingMetric()
public java.lang.String[] getOptions()
getOptions
in interface weka.core.OptionHandler
public int[] search(weka.attributeSelection.ASEvaluation ASEvaluator, weka.core.Instances data) throws java.lang.Exception
search
in class weka.attributeSelection.ASSearch
exception
- is something goes wrongjava.lang.Exception
protected void runIWSS(int toVisit, int[] ranking, weka.attributeSelection.ASEvaluation ASEvaluator) throws java.lang.Exception
java.lang.Exception
protected void runIWSSreplace(int toVisit, int[] ranking, weka.attributeSelection.ASEvaluation ASEvaluator) throws java.lang.Exception
java.lang.Exception
protected int[] doRanking()
protected int computeWrapperGoodness(double[] storeGoodness, weka.classifiers.Classifier tempClassifier, weka.core.SelectedTag eval_tag) throws java.lang.Exception
storeGoodness
- array in which to store the goodness computed for each foldtempClassifier
- model to use for classificationjava.lang.Exception
public void setStartSet(java.lang.String set) throws java.lang.Exception
setStartSet
in interface weka.attributeSelection.StartSetHandler
set
- a string set of consecutive values starting by 1 (for GUI
Explorer compatibility), separated by comma.java.lang.Exception
- if set does not start by 1 or numbers are not consecutivepublic java.lang.String getStartSet()
getStartSet
in interface weka.attributeSelection.StartSetHandler
public weka.core.TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface weka.core.TechnicalInformationHandler
public java.lang.String globalInfo()
public java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.String getRankingMetricSpec()