Class AbstractWekaPredictionsTransformer

  • 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, adams.flow.core.OutputProducer, Serializable, Comparable
    Direct Known Subclasses:
    WekaPredictionsToInstances, WekaPredictionsToSpreadSheet

    public abstract class AbstractWekaPredictionsTransformer
    extends adams.flow.transformer.AbstractTransformer
    Ancestor for transformers that convert the predictions stored in an Evaluation object into a different format.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean m_AddLabelIndex
      whether to prefix the labels with a 1-based index (only nominal classes).
      protected String m_MeasuresPrefix
      the optional prefix to disambiguate the measure attributes from the original ones.
      protected boolean m_ShowDistribution
      whether to output the class distribution (only nominal classes).
      protected boolean m_ShowError
      whether to add an error colunm.
      protected boolean m_ShowProbability
      whether to output the probability of the prediction (only nominal classes).
      protected boolean m_ShowWeight
      whether to output the weight as well.
      protected WekaAttributeRange m_TestAttributes
      the additional attributes from the test data to add to the output.
      protected boolean m_UseAbsoluteError
      whether to use absolute errors.
      protected boolean m_UseOriginalIndices
      whether to align output with original dataset (if possible).
      • Fields inherited from class adams.flow.transformer.AbstractTransformer

        BACKUP_INPUT, BACKUP_OUTPUT, m_InputToken, m_OutputToken
      • 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.
      String addLabelIndexTipText()
      Returns the tip text for this property.
      void defineOptions()
      Adds options to the internal list of options.
      protected weka.core.Instances filterTestData​(weka.core.Instances data)
      Filters the data accordingly to the selected attribute range.
      boolean getAddLabelIndex()
      Returns whether to show the error as well.
      String getMeasuresPrefix()
      Returns the prefix for the measure attributes.
      String getQuickInfo()
      Returns a quick info about the actor, which will be displayed in the GUI.
      boolean getShowDistribution()
      Returns whether to show the class distribution as well.
      boolean getShowError()
      Returns whether to show the error as well.
      boolean getShowProbability()
      Returns whether to show the probability as well.
      boolean getShowWeight()
      Returns whether to show the weight as well.
      WekaAttributeRange getTestAttributes()
      Returns the range of attributes from the test to add to the output.
      boolean getUseAbsoluteError()
      Returns whether to use an absolute error (ie no direction).
      boolean getUseOriginalIndices()
      Returns whether to align with original data (requires: WekaEvaluationContainer as input and original indices in container).
      String measuresPrefixTipText()
      Returns the tip text for this property.
      void setAddLabelIndex​(boolean value)
      Sets whether to prefix the labels with the index.
      void setMeasuresPrefix​(String value)
      Sets the prefix for the measure attributes.
      void setShowDistribution​(boolean value)
      Sets whether to show the class distribution as well.
      void setShowError​(boolean value)
      Sets whether to show the error as well.
      void setShowProbability​(boolean value)
      Sets whether to show the probability of the prediction as well.
      void setShowWeight​(boolean value)
      Sets whether to show the weight as well.
      void setTestAttributes​(WekaAttributeRange value)
      Sets the range of attributes from the test to add to the output.
      void setUseAbsoluteError​(boolean value)
      Sets whether to use an absolute error (ie no direction).
      void setUseOriginalIndices​(boolean value)
      Sets whether to align with original data (requires: WekaEvaluationContainer as input and original indices in container).
      String showDistributionTipText()
      Returns the tip text for this property.
      String showErrorTipText()
      Returns the tip text for this property.
      String showProbabilityTipText()
      Returns the tip text for this property.
      String showWeightTipText()
      Returns the tip text for this property.
      String testAttributesTipText()
      Returns the tip text for this property.
      String useAbsoluteErrorTipText()
      Returns the tip text for this property.
      String useOriginalIndicesTipText()
      Returns the tip text for this property.
      • Methods inherited from class adams.flow.transformer.AbstractTransformer

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

        annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, doExecute, equals, 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, globalInfo, 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, 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.flow.core.OutputProducer

        generates
      • Methods inherited from interface adams.core.VariablesInspectionHandler

        canInspectOptions
    • Field Detail

      • m_AddLabelIndex

        protected boolean m_AddLabelIndex
        whether to prefix the labels with a 1-based index (only nominal classes).
      • m_ShowError

        protected boolean m_ShowError
        whether to add an error colunm.
      • m_UseAbsoluteError

        protected boolean m_UseAbsoluteError
        whether to use absolute errors.
      • m_ShowProbability

        protected boolean m_ShowProbability
        whether to output the probability of the prediction (only nominal classes).
      • m_ShowDistribution

        protected boolean m_ShowDistribution
        whether to output the class distribution (only nominal classes).
      • m_ShowWeight

        protected boolean m_ShowWeight
        whether to output the weight as well.
      • m_UseOriginalIndices

        protected boolean m_UseOriginalIndices
        whether to align output with original dataset (if possible).
      • m_TestAttributes

        protected WekaAttributeRange m_TestAttributes
        the additional attributes from the test data to add to the output.
      • m_MeasuresPrefix

        protected String m_MeasuresPrefix
        the optional prefix to disambiguate the measure attributes from the original ones.
    • Constructor Detail

      • AbstractWekaPredictionsTransformer

        public AbstractWekaPredictionsTransformer()
    • Method Detail

      • 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
      • setAddLabelIndex

        public void setAddLabelIndex​(boolean value)
        Sets whether to prefix the labels with the index.
        Parameters:
        value - true if the label is prefixed with the index
      • getAddLabelIndex

        public boolean getAddLabelIndex()
        Returns whether to show the error as well.
        Returns:
        true if the label is prefixed with the index
      • addLabelIndexTipText

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

        public void setShowError​(boolean value)
        Sets whether to show the error as well.
        Parameters:
        value - true if the error is to be displayed as well
      • getShowError

        public boolean getShowError()
        Returns whether to show the error as well.
        Returns:
        true if the error is displayed as well
      • showErrorTipText

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

        public void setUseAbsoluteError​(boolean value)
        Sets whether to use an absolute error (ie no direction).
        Parameters:
        value - true if to use absolute error
      • getUseAbsoluteError

        public boolean getUseAbsoluteError()
        Returns whether to use an absolute error (ie no direction).
        Returns:
        true if to use absolute error
      • useAbsoluteErrorTipText

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

        public void setShowProbability​(boolean value)
        Sets whether to show the probability of the prediction as well.
        Parameters:
        value - true if the probability is to be displayed as well
      • getShowProbability

        public boolean getShowProbability()
        Returns whether to show the probability as well.
        Returns:
        true if the probability is displayed as well
      • showProbabilityTipText

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

        public void setShowDistribution​(boolean value)
        Sets whether to show the class distribution as well.
        Parameters:
        value - true if the class distribution is to be displayed as well
      • getShowDistribution

        public boolean getShowDistribution()
        Returns whether to show the class distribution as well.
        Returns:
        true if the class distribution is displayed as well
      • showDistributionTipText

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

        public void setShowWeight​(boolean value)
        Sets whether to show the weight as well.
        Parameters:
        value - true if the weight is to be displayed as well
      • getShowWeight

        public boolean getShowWeight()
        Returns whether to show the weight as well.
        Returns:
        true if the weight is displayed as well
      • showWeightTipText

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

        public void setUseOriginalIndices​(boolean value)
        Sets whether to align with original data (requires: WekaEvaluationContainer as input and original indices in container).
        Parameters:
        value - true if to align with original data
      • getUseOriginalIndices

        public boolean getUseOriginalIndices()
        Returns whether to align with original data (requires: WekaEvaluationContainer as input and original indices in container).
        Returns:
        true if to align with original data
      • useOriginalIndicesTipText

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

        public void setTestAttributes​(WekaAttributeRange value)
        Sets the range of attributes from the test to add to the output.
        Parameters:
        value - the range
      • getTestAttributes

        public WekaAttributeRange getTestAttributes()
        Returns the range of attributes from the test to add to the output.
        Returns:
        the range
      • testAttributesTipText

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

        public void setMeasuresPrefix​(String value)
        Sets the prefix for the measure attributes.
        Parameters:
        value - the prefix
      • getMeasuresPrefix

        public String getMeasuresPrefix()
        Returns the prefix for the measure attributes.
        Returns:
        the prefix
      • measuresPrefixTipText

        public String measuresPrefixTipText()
        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:
        the accepted classes
      • filterTestData

        protected weka.core.Instances filterTestData​(weka.core.Instances data)
        Filters the data accordingly to the selected attribute range.
        Parameters:
        data - the data to filter
        Returns:
        the filtered data, null if filtering failed