adams.flow.transformer
Class WekaClassifierRanker.RankingJob

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.multiprocess.Job
          extended by adams.flow.transformer.WekaClassifierRanker.RankingJob
All Implemented Interfaces:
CleanUpHandler, SizeOfHandler, Serializable
Enclosing class:
WekaClassifierRanker

public static class WekaClassifierRanker.RankingJob
extends Job

A job class specific to ranking classifiers.

Version:
$Revision: 4665 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
protected  weka.classifiers.Classifier m_BestClassifier
          the best classifier.
protected  weka.classifiers.Classifier m_Classifier
          the classifier to evaluate.
protected  String m_EvaluationError
          for storing evaluating errors.
protected  int m_Folds
          the number of folds to use.
protected  int m_Index
          the index in actor's input array.
protected  WekaClassifierRanker.Measure m_Measure
          the measure to use for ranking.
protected  boolean m_OutputBestSetup
          whether to output the best classifier.
protected  Performance m_Performance
          the performance.
protected  long m_Seed
          the seed value to use.
protected  weka.core.Instances m_Test
          the test data to evaluate with (if folds less than 2).
protected  weka.core.Instances m_Train
          the train data to evaluate with.
 
Fields inherited from class adams.multiprocess.Job
m_complete, m_completed, m_depends, m_ExecutionError, m_jobInfo, m_jobParams
 
Constructor Summary
WekaClassifierRanker.RankingJob(weka.classifiers.Classifier cls, int index, weka.core.Instances train, weka.core.Instances test, long seed, int folds, WekaClassifierRanker.Measure measure, boolean best)
          Initializes the job.
 
Method Summary
 void cleanUp()
          Cleans up data structures, frees up memory.
protected  String getAdditionalErrorInformation()
          Returns additional information to be added to the error message.
 weka.classifiers.Classifier getBestClassifier()
          Returns the best classifier found.
protected  weka.classifiers.Classifier getBestClassifier(weka.classifiers.Classifier template, weka.classifiers.Classifier trained)
          In case of GridSearch/MultiSearch the best setup is returned, otherwise the classifier itself.
 weka.classifiers.Classifier getClassifier()
          Returns the classifier being used.
 int getFolds()
          Returns the number of folds.
 int getIndex()
          Returns the index of the classifier in the actor's input array.
 WekaClassifierRanker.Measure getMeasure()
          Returns the measure for ranking.
 boolean getOutputBestSetup()
          Returns whether the best setup is output in case of optimizers like GridSearch/MultiSearch.
 Performance getPerformance()
          The generated performance.
 long getSeed()
          Returns the seed value.
 weka.core.Instances getTest()
          The test data.
 weka.core.Instances getTrain()
          The training data.
protected  String postProcessCheck()
          Checks whether all post-conditions have been met.
protected  String preProcessCheck()
          Checks whether all pre-conditions have been met.
protected  void process()
          Does the actual execution of the job.
 String toString()
          Returns a string representation of the job.
 
Methods inherited from class adams.multiprocess.Job
addDependency, addParam, execute, getAsVector, getDependencies, getExecutionError, getJobCompleteListener, getJobInfo, getParam, hasExecutionError, isComplete, jobCompleted, setJobCompleteListener
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut, sizeOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_Classifier

protected weka.classifiers.Classifier m_Classifier
the classifier to evaluate.


m_Index

protected int m_Index
the index in actor's input array.


m_Train

protected weka.core.Instances m_Train
the train data to evaluate with.


m_Test

protected weka.core.Instances m_Test
the test data to evaluate with (if folds less than 2).


m_Seed

protected long m_Seed
the seed value to use.


m_Folds

protected int m_Folds
the number of folds to use.


m_Measure

protected WekaClassifierRanker.Measure m_Measure
the measure to use for ranking.


m_Performance

protected Performance m_Performance
the performance.


m_EvaluationError

protected String m_EvaluationError
for storing evaluating errors.


m_OutputBestSetup

protected boolean m_OutputBestSetup
whether to output the best classifier.


m_BestClassifier

protected weka.classifiers.Classifier m_BestClassifier
the best classifier.

Constructor Detail

WekaClassifierRanker.RankingJob

public WekaClassifierRanker.RankingJob(weka.classifiers.Classifier cls,
                                       int index,
                                       weka.core.Instances train,
                                       weka.core.Instances test,
                                       long seed,
                                       int folds,
                                       WekaClassifierRanker.Measure measure,
                                       boolean best)
Initializes the job.

Parameters:
cls - the classifier to evaluate
index - the index of the classifier in input array
train - the training data to use
test - the test data to use
seed - the seed value to use
folds - the number of folds to use
measure - the measure to use for ranking
best - whether to output the best classifier setup (for optimizers)
Method Detail

getClassifier

public weka.classifiers.Classifier getClassifier()
Returns the classifier being used.

Returns:
the classifier in use

getIndex

public int getIndex()
Returns the index of the classifier in the actor's input array.

Returns:
the index

getTrain

public weka.core.Instances getTrain()
The training data.

Returns:
the training data

getTest

public weka.core.Instances getTest()
The test data.

Returns:
the test data

getSeed

public long getSeed()
Returns the seed value.

Returns:
the seed value

getFolds

public int getFolds()
Returns the number of folds.

Returns:
the folds

getMeasure

public WekaClassifierRanker.Measure getMeasure()
Returns the measure for ranking.

Returns:
the measure

getPerformance

public Performance getPerformance()
The generated performance.

Returns:
the performance, can be null

getBestClassifier

public weka.classifiers.Classifier getBestClassifier()
Returns the best classifier found. For optimizers like GridSearch, this outputs the best setup found. For all others, that's the same setup as the actual classifier that was evaluated.

Returns:
the best setup or the original setup

getOutputBestSetup

public boolean getOutputBestSetup()
Returns whether the best setup is output in case of optimizers like GridSearch/MultiSearch.

Returns:
true if the best setup is output

preProcessCheck

protected String preProcessCheck()
Checks whether all pre-conditions have been met.

Specified by:
preProcessCheck in class Job
Returns:
null if everything is OK, otherwise an error message

getBestClassifier

protected weka.classifiers.Classifier getBestClassifier(weka.classifiers.Classifier template,
                                                        weka.classifiers.Classifier trained)
In case of GridSearch/MultiSearch the best setup is returned, otherwise the classifier itself.

Parameters:
template - the template classifier
trained - the trained classifier
Returns:
either the best classifier (in case of GridSearch/MultiSearch) or the template

process

protected void process()
Does the actual execution of the job.

Specified by:
process in class Job

postProcessCheck

protected String postProcessCheck()
Checks whether all post-conditions have been met.

Specified by:
postProcessCheck in class Job
Returns:
null if everything is OK, otherwise an error message

cleanUp

public void cleanUp()
Cleans up data structures, frees up memory. Sets the input data to null.

Specified by:
cleanUp in interface CleanUpHandler
Overrides:
cleanUp in class Job

getAdditionalErrorInformation

protected String getAdditionalErrorInformation()
Returns additional information to be added to the error message.

Overrides:
getAdditionalErrorInformation in class Job
Returns:
the additional information

toString

public String toString()
Returns a string representation of the job.

Specified by:
toString in class Job
Returns:
a string representation


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.