@KFStep(name="ASEvaluator", category="AttSelection", toolTipText="Weka attribute selection evaluator wrapper", iconPath="", resourceIntensive=true) public class ASEvaluator extends WekaAlgorithmWrapper
ASSearchStrategy,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected AttributeSelection |
m_eval
Eval to use when performing a cross-validation and not outputting separate
results for each fold
|
protected ASEvaluation |
m_evaluatorTemplate
The evaluator (attribute or subset) being used
|
protected boolean |
m_isDoingXVal
True if we are processing cross-validation folds to produce a summary over
the folds (as opposed to producing separate results per fold).
|
protected boolean |
m_isRanking
Whether a ranking is being produced by the attribute selection
|
protected boolean |
m_isReset
True if we've been reset
|
protected java.util.Map<java.lang.Integer,java.lang.Integer> |
m_numToSelectStore
Holds the calculated number of attributes to select (may depend on
thresholds) for each training fold
|
protected ASSearch |
m_searchTemplate
The search strategy being used (retrieved via an incoming "info" connection
|
protected java.util.Map<java.lang.Integer,int[]> |
m_selectedAttsStore
Holds selected attribute indices corresponding to training folds
|
protected java.util.concurrent.atomic.AtomicInteger |
m_setCount
Keeps count of the folds processed
|
protected java.util.Map<java.lang.Integer,AttributeTransformer> |
m_transformerStore
Holds the evaluator trained per fold in the case when it is a transformer
(such as PCA)
|
protected boolean |
m_treatXValFoldsSeparately
Whether to output separate evaluation results for each fold of a xval or
report the cross-validation summary
|
protected java.util.Map<java.lang.Integer,Instances> |
m_waitingTestData
Any test folds waiting to be processed (i.e. have their dimensionality
reduced
|
m_defaultIconPath, m_defaultPackageIconPath, m_iconPath, m_wrappedAlgorithmm_stepIsResourceIntensive, m_stepManager, m_stepName| Constructor and Description |
|---|
ASEvaluator() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyFiltering(java.lang.String connType,
int[] selectedAtts,
Instances data,
java.lang.Integer setNum,
java.lang.Integer maxSetNum)
Apply a filter to reduce the dimensionality of the supplied data.
|
protected void |
checkTestFiltering(Instances test,
java.lang.Integer setNum,
java.lang.Integer maxSetNum)
Check to see if there is a waiting set of selected attributes that can be
used to reduce the dimensionality of the supplied test set
|
java.lang.String |
getCustomEditorForStep()
Get the class name of the custom editor for this step
|
ASEvaluation |
getEvaluator()
Get the evaluator wrapped by this step
|
java.util.List<java.lang.String> |
getIncomingConnectionTypes()
Get incoming connections accepted given the current state of the step
|
java.util.List<java.lang.String> |
getOutgoingConnectionTypes()
Get a list of output connections that can be produced given the current
state of the step
|
boolean |
getTreatXValFoldsSeparately()
Get whether to output separate results for each fold of a cross-validation,
rather than averaging over folds.
|
java.lang.Class |
getWrappedAlgorithmClass()
Get the class of Weka algorithm wrapped by this wrapper
|
protected void |
outputTextData(java.lang.String text,
java.lang.Integer setNum)
Output Data to outgoing text connections
|
void |
processIncoming(Data data)
Process an incoming Data object
|
protected void |
processNonXVal(Instances train,
Instances test,
java.lang.Integer setNum,
java.lang.Integer maxSetNum)
Handles processing for single train sets, single train/test pairs or
cross-validation folds when results are output for each separately
|
protected void |
processXVal(Instances train,
Instances test,
java.lang.Integer setNum,
java.lang.Integer maxSetNum)
Handles processing in the cross-validation case when results are to be
accumulated/averaged over the folds
|
void |
setEvaluator(ASEvaluation eval)
Set the evaluator to wrap (just calls setWrappedAlgorithm)
|
void |
setTreatXValFoldsSeparately(boolean treatSeparately)
Set whether to output separate results for each fold of a cross-validation,
rather than averaging over folds.
|
void |
setWrappedAlgorithm(java.lang.Object algo)
Set an instance of the wrapped algorithm to use
|
void |
stepInit()
Initialize at the start of a run
|
protected void |
updateXValStats(Instances train,
ASEvaluation evaluator,
ASSearch search,
int[] selectedAtts)
Updates stats in the cross-validation case
|
getDefaultIconPath, getDefaultPackageLevelIconPath, getIconPath, getWrappedAlgorithm, globalInfoenvironmentSubstitute, getDefaultSettings, getInteractiveViewers, getInteractiveViewersImpls, getName, getStepManager, isResourceIntensive, isStopRequested, outputStructureForConnectionType, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stopprotected ASEvaluation m_evaluatorTemplate
protected ASSearch m_searchTemplate
protected java.util.Map<java.lang.Integer,Instances> m_waitingTestData
protected java.util.Map<java.lang.Integer,int[]> m_selectedAttsStore
protected java.util.Map<java.lang.Integer,java.lang.Integer> m_numToSelectStore
protected java.util.Map<java.lang.Integer,AttributeTransformer> m_transformerStore
protected boolean m_isReset
protected boolean m_isDoingXVal
protected java.util.concurrent.atomic.AtomicInteger m_setCount
protected boolean m_treatXValFoldsSeparately
protected boolean m_isRanking
protected AttributeSelection m_eval
public java.lang.Class getWrappedAlgorithmClass()
getWrappedAlgorithmClass in class WekaAlgorithmWrapperpublic void setWrappedAlgorithm(java.lang.Object algo)
setWrappedAlgorithm in class WekaAlgorithmWrapperalgo - the algorithm to usepublic ASEvaluation getEvaluator()
@ProgrammaticProperty public void setEvaluator(ASEvaluation eval)
eval - the evaluator to use@OptionMetadata(displayName="Treat x-val folds separately", description="Output separate attribute selection results for each fold of a cross-validation (rather than averaging across folds)") public void setTreatXValFoldsSeparately(boolean treatSeparately)
treatSeparately - true if each fold will have results outputpublic boolean getTreatXValFoldsSeparately()
public void stepInit()
throws WekaException
WekaException - if there is an illegal configuration (i.e. Ranker
search with subset evaluator or regular search with attribute
evaluatorpublic void processIncoming(Data data) throws WekaException
processIncoming in interface BaseStepExtenderprocessIncoming in interface StepprocessIncoming in class BaseStepdata - the data object to processWekaException - if a problem occursprotected void outputTextData(java.lang.String text,
java.lang.Integer setNum)
throws WekaException
text - the text to outputsetNum - the fold/set number that this text is associated withWekaException - if a problem occursprotected void processNonXVal(Instances train, Instances test, java.lang.Integer setNum, java.lang.Integer maxSetNum) throws WekaException
train - the training datatest - the test datasetNum - the set number for the training/test datamaxSetNum - the maximum set numberWekaException - if a problem occursprotected void processXVal(Instances train, Instances test, java.lang.Integer setNum, java.lang.Integer maxSetNum) throws WekaException
train - the training datatest - the test datasetNum - the set number of this train/test pairmaxSetNum - the maximum set numberWekaException - if a problem occursprotected void checkTestFiltering(Instances test, java.lang.Integer setNum, java.lang.Integer maxSetNum) throws WekaException
test - the test set to potentially filtersetNum - the set number of the test setmaxSetNum - the maximum set numberWekaException - if a problem occursprotected void applyFiltering(java.lang.String connType,
int[] selectedAtts,
Instances data,
java.lang.Integer setNum,
java.lang.Integer maxSetNum)
throws WekaException
connType - the connection type to output onselectedAtts - selected attribute indices to use when filteringdata - the instances to filtersetNum - the set number of the instancesmaxSetNum - the maximum set numberWekaException - if a problem occursprotected void updateXValStats(Instances train, ASEvaluation evaluator, ASSearch search, int[] selectedAtts) throws java.lang.Exception
train - the training data processedevaluator - the evaluator usedsearch - the search strategyselectedAtts - the attributes selected on this training datajava.lang.Exception - if a problem occurspublic java.util.List<java.lang.String> getIncomingConnectionTypes()
public java.util.List<java.lang.String> getOutgoingConnectionTypes()
public java.lang.String getCustomEditorForStep()
getCustomEditorForStep in interface StepgetCustomEditorForStep in class BaseStep