Class Predictions

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.SizeOfHandler, Serializable

    public class Predictions
    extends AbstractOutputGenerator
    Displays the predictions.
    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 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.
      • Fields inherited from class adams.core.option.AbstractOptionHandler

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

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Constructor Summary

      Constructors 
      Constructor Description
      Predictions()  
    • 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_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.
    • Constructor Detail

      • Predictions

        public Predictions()
    • 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.core.option.AbstractOptionHandler
      • 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.
      • 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.
      • createOutput

        protected TableContentPanel createOutput​(weka.classifiers.Evaluation eval,
                                                 int[] originalIndices,
                                                 adams.data.spreadsheet.SpreadSheet additionalAttributes,
                                                 adams.core.MessageCollection errors)
        Generates the output from the evaluation.
        Parameters:
        eval - the evaluation to use
        originalIndices - the original indices, can be null
        additionalAttributes - the additional attributes to use, can be null
        errors - for collecting error messages
        Returns:
        the generated output
      • createOutput

        public JComponent createOutput​(ResultItem item,
                                       adams.core.MessageCollection errors)
        Generates output from the item.
        Specified by:
        createOutput in class AbstractOutputGenerator<ResultItem>
        Parameters:
        item - the item to generate output for
        errors - for collecting error messages
        Returns:
        the output component, null if failed to generate