Class WekaPredictionContainerToSpreadSheet

  • 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.data.conversion.AbstractConversion>, adams.core.SizeOfHandler, adams.core.Stoppable, adams.data.conversion.Conversion, Serializable

    public class WekaPredictionContainerToSpreadSheet
    extends adams.data.conversion.AbstractConversion
    Turns a WEKA prediction container into a SpreadSheet object.

    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
     
    -title-name-column <java.lang.String> (property: titleNameColumn)
        The title of the first column.
        default: Name
     
    -title-value-column <java.lang.String> (property: titleValueColumn)
        The title of the second column.
        default: Value
     
    -add-classification (property: addClassification)
        If enabled, then the numeric classification (index of class label for nominal
        classes) is added to the spreadsheet.
     
    -classification-entry <java.lang.String> (property: classificationEntry)
        The value to use in the 'Name' column for the numeric classification.
        default: Classification
     
    -add-classification-label (property: addClassificationLabel)
        If enabled, then the classification label (only for nominal classes) is
        added to the spreadsheet.
     
    -classification-label-entry <java.lang.String> (property: classificationLabelEntry)
        The value to use in the 'Name' column for the classification label.
        default: Class
     
    -add-distribution (property: addDistribution)
        If enabled, then the class distribution (only for nominal classes) is added
        to the spreadsheet.
     
    -distribution-format <java.lang.String> (property: distributionFormat)
        The format to use in the 'Name' column for the class distribution; '{INDEX
        }' can be used for the 1-based index, '{LABEL}' can be used for the class
        label (if available; if not, the 1-based index is used instead)
        default: {LABEL}
     
    -distribution-sorting <NONE|DESCENDING|ASCENDING> (property: distributionSorting)
        The type of sorting to apply to the distribution array.
        default: NONE
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • PLACEHOLDER_LABEL

        public static final String PLACEHOLDER_LABEL
        the placeholder for the class label in the distribution format.
        See Also:
        Constant Field Values
      • PLACEHOLDER_INDEX

        public static final String PLACEHOLDER_INDEX
        the placeholder for the class index in the distribution format.
        See Also:
        Constant Field Values
      • m_TitleNameColumn

        protected String m_TitleNameColumn
        the title of the name column.
      • m_TitleValueColumn

        protected String m_TitleValueColumn
        the title of the value column.
      • m_AddClassification

        protected boolean m_AddClassification
        whether to add the numeric classification to the output.
      • m_ClassificationEntry

        protected String m_ClassificationEntry
        the entry to use for the numeric classification in the spreadsheet.
      • m_AddClassificationLabel

        protected boolean m_AddClassificationLabel
        whether to add the classification label to the output (nominal classes only).
      • m_ClassificationLabelEntry

        protected String m_ClassificationLabelEntry
        the entry to use for the classification label in the spreadsheet.
      • m_AddDistribution

        protected boolean m_AddDistribution
        whether to add the distribution to the output (nominal classes only).
      • m_DistributionFormat

        protected String m_DistributionFormat
        the format to use for the distribution entries in the spreadsheet.
    • Constructor Detail

      • WekaPredictionContainerToSpreadSheet

        public WekaPredictionContainerToSpreadSheet()
    • 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
      • setTitleNameColumn

        public void setTitleNameColumn​(String value)
        Sets the title of the "Name" column, i.e., the first column.
        Parameters:
        value - the title
      • getTitleNameColumn

        public String getTitleNameColumn()
        Returns the title of the "Name" column, i.e., the first column.
        Returns:
        the title
      • titleNameColumnTipText

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

        public void setTitleValueColumn​(String value)
        Sets the title of the "Value" column, i.e., the first column.
        Parameters:
        value - the title
      • getTitleValueColumn

        public String getTitleValueColumn()
        Returns the title of the "Value" column, i.e., the first column.
        Returns:
        the title
      • titleValueColumnTipText

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

        public void setAddClassification​(boolean value)
        Sets whether to add the numeric classification (label index for nominal classes).
        Parameters:
        value - true if to add numeric classification
      • getAddClassification

        public boolean getAddClassification()
        Returns whether to add the numeric classification (label index for nominal classes).
        Returns:
        true if numeric classification is added
      • addClassificationTipText

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

        public void setClassificationEntry​(String value)
        Sets the value for the 'Name' column for the numeric classification.
        Parameters:
        value - the name
      • getClassificationEntry

        public String getClassificationEntry()
        Returns the value for the 'Name' column for the numeric classification.
        Returns:
        the name
      • classificationEntryTipText

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

        public void setAddClassificationLabel​(boolean value)
        Sets whether to add the classification label (only for nominal classes).
        Parameters:
        value - true if to add classification label
      • getAddClassificationLabel

        public boolean getAddClassificationLabel()
        Returns whether to add the classification label (only for nominal classes).
        Returns:
        true if classification label is added
      • addClassificationLabelTipText

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

        public void setClassificationLabelEntry​(String value)
        Sets the value for the 'Name' column for the classification label.
        Parameters:
        value - the name
      • getClassificationLabelEntry

        public String getClassificationLabelEntry()
        Returns the value for the 'Name' column for the classification label.
        Returns:
        the name
      • classificationLabelEntryTipText

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

        public void setAddDistribution​(boolean value)
        Sets whether to add the class distribution (only for nominal classes).
        Parameters:
        value - true if to add class distribution
      • getAddDistribution

        public boolean getAddDistribution()
        Returns whether to add the class distribution (only for nominal classes).
        Returns:
        true if class distribution is added
      • addDistributionTipText

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

        public void setDistributionFormat​(String value)
        Sets the format for the 'Name' column for the class distribution.
        Parameters:
        value - the format
        See Also:
        PLACEHOLDER_INDEX, PLACEHOLDER_LABEL
      • getDistributionFormat

        public String getDistributionFormat()
        Returns the format for the 'Name' column for the numeric classification.
        Returns:
        the format
        See Also:
        PLACEHOLDER_INDEX, PLACEHOLDER_LABEL
      • distributionFormatTipText

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

        public String distributionSortingTipText()
        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 is accepted as input.
        Specified by:
        accepts in interface adams.data.conversion.Conversion
        Specified by:
        accepts in class adams.data.conversion.AbstractConversion
        Returns:
        the class
      • generates

        public Class generates()
        Returns the class that is generated as output.
        Specified by:
        generates in interface adams.data.conversion.Conversion
        Specified by:
        generates in class adams.data.conversion.AbstractConversion
        Returns:
        the class
      • doConvert

        protected Object doConvert()
                            throws Exception
        Performs the actual conversion.
        Specified by:
        doConvert in class adams.data.conversion.AbstractConversion
        Returns:
        the converted data
        Throws:
        Exception - if something goes wrong with the conversion