Class WekaExperimentGenerator

  • All Implemented Interfaces:
    adams.core.AdditionalInformationHandler, adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.ShallowCopySupporter<adams.flow.core.Actor>, adams.core.SizeOfHandler, adams.core.Stoppable, adams.core.StoppableWithFeedback, adams.core.VariablesInspectionHandler, adams.event.VariableChangeListener, adams.flow.core.Actor, adams.flow.core.ErrorHandler, adams.flow.core.InputConsumer, Serializable, Comparable

    public class WekaExperimentGenerator
    extends adams.flow.sink.AbstractSink
    Generates an experiment setup that can be used in conjunction with the Experiment transformer actor.

    Input/output:
    - accepts:
       weka.classifiers.Classifier[]


    Valid options are:

    -D <int> (property: debugLevel)
        The greater the number the more additional info the scheme may output to
        the console (0 = off).
        default: 0
        minimum: 0
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: ExperimentGenerator
     
    -annotation <adams.core.base.BaseText> (property: annotations)
        The annotations to attach to this actor.
        default:
     
    -skip (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded
        as it is.
     
    -exp-type <CLASSIFICATION|REGRESSION> (property: experimentType)
        The type of experiment to perform.
        default: CLASSIFICATION
     
    -eval-type <CROSS_VALIDATION|TRAIN_TEST_SPLIT_RANDOMIZED|TRAIN_TEST_SPLIT_ORDER_PRESERVED> (property: evaluationType)
        The type of evaluation to perform.
        default: CROSS_VALIDATION
     
    -runs <int> (property: runs)
        The number of runs to perform.
        default: 10
        minimum: 1
     
    -folds <int> (property: folds)
        The number of folds to use in cross-validation.
        default: 10
        minimum: 2
     
    -split <double> (property: splitPercentage)
        The percentage to use in train/test splits.
        default: 66.0
        minimum: 1.0E-4
        maximum: 99.9999
     
    -result-format <ARFF|CSV> (property: resultFormat)
        The data format the experimental results are stored in.
        default: ARFF
     
    -result-file <adams.core.io.PlaceholderFile> (property: resultFile)
        The file to store the experimental results in.
        default: .
     
    -output <adams.core.io.PlaceholderFile> (property: outputFile)
        The file to store the experiment setup in (the extension determines the
        type).
        default: .
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected WekaExperimentGenerator.EvaluationType m_EvaluationType
      the type of evaluation.
      protected WekaExperimentGenerator.ExperimentType m_ExperimentType
      the type of experiment.
      protected int m_Folds
      the number of folds to use (only cross-validation).
      protected adams.core.io.PlaceholderFile m_OutputFile
      the file to store the experiment in.
      protected adams.core.io.PlaceholderFile m_ResultFile
      the file to store the result in.
      protected WekaExperimentGenerator.ResultFormat m_ResultFormat
      the result format.
      protected int m_Runs
      the number of runs to perform.
      protected double m_SplitPercentage
      the split-percentage to use (only train/test splits).
      • Fields inherited from class adams.flow.sink.AbstractSink

        BACKUP_INPUT, m_InputToken
      • Fields inherited from class adams.flow.core.AbstractActor

        m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
      • Fields inherited from interface adams.flow.core.Actor

        FILE_EXTENSION, FILE_EXTENSION_GZ
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Class[] accepts()
      Returns the class that the consumer accepts.
      void defineOptions()
      Adds options to the internal list of options.
      protected String doExecute()
      Executes the flow item.
      String evaluationTypeTipText()
      Returns the tip text for this property.
      String experimentTypeTipText()
      Returns the tip text for this property.
      String foldsTipText()
      Returns the tip text for this property.
      WekaExperimentGenerator.EvaluationType getEvaluationType()
      Returns the type of evaluation to perform.
      WekaExperimentGenerator.ExperimentType getExperimentType()
      Returns the type of experiment to perform.
      int getFolds()
      Returns the number of folds to use (only CV).
      adams.core.io.PlaceholderFile getOutputFile()
      Returns the file to store the experiment in.
      String getQuickInfo()
      Returns a quick info about the actor, which will be displayed in the GUI.
      adams.core.io.PlaceholderFile getResultFile()
      Returns the file to store the experimental results in.
      WekaExperimentGenerator.ResultFormat getResultFormat()
      Returns the data format the results are stored in.
      int getRuns()
      Returns the number of runs to perform.
      double getSplitPercentage()
      Returns the split percentage (only train/test splits).
      String globalInfo()
      Returns a string describing the object.
      String outputFileTipText()
      Returns the tip text for this property.
      String resultFileTipText()
      Returns the tip text for this property.
      String resultFormatTipText()
      Returns the tip text for this property.
      String runsTipText()
      Returns the tip text for this property.
      void setEvaluationType​(WekaExperimentGenerator.EvaluationType value)
      Sets the type of evaluation to perform.
      void setExperimentType​(WekaExperimentGenerator.ExperimentType value)
      Sets the type of experiment to perform.
      void setFolds​(int value)
      Sets the number of folds to use (only CV).
      void setOutputFile​(adams.core.io.PlaceholderFile value)
      Sets the file to store the experiment setup in (the extensions determines the type).
      void setResultFile​(adams.core.io.PlaceholderFile value)
      Sets the file to store the experimental results in.
      void setResultFormat​(WekaExperimentGenerator.ResultFormat value)
      Sets the data format the results are stored in.
      void setRuns​(int value)
      Sets the number of runs to perform.
      void setSplitPercentage​(double value)
      Sets the split percentage (only train/test splits).
      String splitPercentageTipText()
      Returns the tip text for this property.
      • Methods inherited from class adams.flow.sink.AbstractSink

        backupState, currentInput, hasInput, input, postExecute, restoreState, wrapUp
      • Methods inherited from class adams.flow.core.AbstractActor

        annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, preExecute, pruneBackup, pruneBackup, reset, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
      • Methods inherited from interface adams.flow.core.Actor

        cleanUp, compareTo, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, stopExecution, toCommandLine, variableChanged
      • Methods inherited from interface adams.core.AdditionalInformationHandler

        getAdditionalInformation
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel, setLoggingLevel
      • Methods inherited from interface adams.core.logging.LoggingSupporter

        getLogger, isLoggingEnabled
      • Methods inherited from interface adams.core.option.OptionHandler

        cleanUpOptions, getOptionManager
      • Methods inherited from interface adams.core.VariablesInspectionHandler

        canInspectOptions
    • Field Detail

      • m_Runs

        protected int m_Runs
        the number of runs to perform.
      • m_Folds

        protected int m_Folds
        the number of folds to use (only cross-validation).
      • m_SplitPercentage

        protected double m_SplitPercentage
        the split-percentage to use (only train/test splits).
      • m_ResultFile

        protected adams.core.io.PlaceholderFile m_ResultFile
        the file to store the result in.
      • m_OutputFile

        protected adams.core.io.PlaceholderFile m_OutputFile
        the file to store the experiment in.
    • Constructor Detail

      • WekaExperimentGenerator

        public WekaExperimentGenerator()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.flow.core.AbstractActor
      • getQuickInfo

        public String getQuickInfo()
        Returns a quick info about the actor, which will be displayed in the GUI.
        Specified by:
        getQuickInfo in interface adams.flow.core.Actor
        Specified by:
        getQuickInfo in interface adams.core.QuickInfoSupporter
        Overrides:
        getQuickInfo in class adams.flow.core.AbstractActor
        Returns:
        null if no info available, otherwise short string
      • experimentTypeTipText

        public String experimentTypeTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • evaluationTypeTipText

        public String evaluationTypeTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setRuns

        public void setRuns​(int value)
        Sets the number of runs to perform.
        Parameters:
        value - the runs
      • getRuns

        public int getRuns()
        Returns the number of runs to perform.
        Returns:
        the runs
      • runsTipText

        public String runsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setFolds

        public void setFolds​(int value)
        Sets the number of folds to use (only CV).
        Parameters:
        value - the folds
      • getFolds

        public int getFolds()
        Returns the number of folds to use (only CV).
        Returns:
        the folds
      • foldsTipText

        public String foldsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSplitPercentage

        public void setSplitPercentage​(double value)
        Sets the split percentage (only train/test splits).
        Parameters:
        value - the percentage (0-100)
      • getSplitPercentage

        public double getSplitPercentage()
        Returns the split percentage (only train/test splits).
        Returns:
        the data format
      • splitPercentageTipText

        public String splitPercentageTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • resultFormatTipText

        public String resultFormatTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setResultFile

        public void setResultFile​(adams.core.io.PlaceholderFile value)
        Sets the file to store the experimental results in.
        Parameters:
        value - the file
      • getResultFile

        public adams.core.io.PlaceholderFile getResultFile()
        Returns the file to store the experimental results in.
        Returns:
        the file
      • resultFileTipText

        public String resultFileTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setOutputFile

        public void setOutputFile​(adams.core.io.PlaceholderFile value)
        Sets the file to store the experiment setup in (the extensions determines the type).
        Parameters:
        value - the file
      • getOutputFile

        public adams.core.io.PlaceholderFile getOutputFile()
        Returns the file to store the experiment in.
        Returns:
        the file
      • outputFileTipText

        public String outputFileTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Returns:
        weka.classifiers.Classifier[].class
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class adams.flow.core.AbstractActor
        Returns:
        null if everything is fine, otherwise error message