Class WekaSpreadSheetToPredictions

  • All Implemented Interfaces:
    AdditionalInformationHandler, ClassCrossReference, CleanUpHandler, CrossReference, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, Actor, ErrorHandler, InputConsumer, OutputProducer, Serializable, Comparable

    public class WekaSpreadSheetToPredictions
    extends AbstractTransformer
    implements ClassCrossReference
    Turns the predictions stored in the incoming spreadsheet (actual and predicted) into a Weka weka.classifiers.Evaluation object.
    For recreating the predictions of a nominal class, the class distributions must be present in the spreadsheet as well.

    See also:
    adams.flow.transformer.WekaPredictionsToSpreadSheet

    Input/output:
    - accepts:
       adams.data.spreadsheet.SpreadSheet
    - generates:
       weka.classifiers.Evaluation


    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: WekaSpreadSheetToPredictions
     
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
        default: 
     
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded 
        as it is.
        default: false
     
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow execution at this level gets stopped in case this 
        actor encounters an error; the error gets propagated; useful for critical 
        actors.
        default: false
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing 
        actor handler must have this enabled as well.
        default: false
     
    -actual <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: actual)
        The column with the actual values.
        default: Actual
        example: An index is a number starting with 1; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
     
    -predicted <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: predicted)
        The column with the predicted values.
        default: Predicted
        example: An index is a number starting with 1; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
     
    -class-distribution <adams.data.spreadsheet.SpreadSheetUnorderedColumnRange> (property: classDistribution)
        The columns containing the class distribution (nominal class).
        default:
        example: A range is a comma-separated list of single 1-based indices or sub-ranges of indices ('start-end'); column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
     
    -column-names-as-class-labels <boolean> (property: useColumnNamesAsClassLabels)
        If enabled, the names of the class distribution columns are used as labels
        in the fake evaluation; automatically removes the surrounding 'Distribution
        (...)'.
        default: false
     
    -weight <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: weight)
        The (optional) column with the weights of the instances; 1.0 is assumed
        by default.
        default:
        example: An index is a number starting with 1; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
     
    -sort-labels <boolean> (property: sortLabels)
        If enabled, the labels get sorted with the specified comparator.
        default: false
     
    -comparator <java.util.Comparator> (property: comparator)
        The comparator to use; must implement java.util.Comparator and java.io.Serializable
        default: adams.core.DefaultCompare
     
    -reverse <boolean> (property: reverse)
        If enabled, the sorting order gets reversed.
        default: false
     
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_UseColumnNamesAsClassLabels

        protected boolean m_UseColumnNamesAsClassLabels
        whether to use the column name as class labels.
      • m_SortLabels

        protected boolean m_SortLabels
        whether to sort the labels.
      • m_Comparator

        protected Comparator m_Comparator
        the comparator to use.
      • m_Reverse

        protected boolean m_Reverse
        whether to reverse the sorting.
    • Constructor Detail

      • WekaSpreadSheetToPredictions

        public WekaSpreadSheetToPredictions()
    • Method Detail

      • setActual

        public void setActual​(SpreadSheetColumnIndex value)
        Sets the column with the actual values.
        Parameters:
        value - the column
      • getActual

        public SpreadSheetColumnIndex getActual()
        Returns the column with the actual values.
        Returns:
        the range
      • actualTipText

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

        public void setPredicted​(SpreadSheetColumnIndex value)
        Sets the column with the predicted values.
        Parameters:
        value - the column
      • getPredicted

        public SpreadSheetColumnIndex getPredicted()
        Returns the column with the predicted values.
        Returns:
        the range
      • predictedTipText

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

        public void setClassDistribution​(SpreadSheetUnorderedColumnRange value)
        Sets the columns with the class distribution (nominal class).
        Parameters:
        value - the range
      • getClassDistribution

        public SpreadSheetUnorderedColumnRange getClassDistribution()
        Returns the columns with the class distribution (nominal class).
        Returns:
        the range
      • classDistributionTipText

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

        public void setUseColumnNamesAsClassLabels​(boolean value)
        Sets whether to use the names of the class distribution columns as labels in the fake evaluation.
        Parameters:
        value - true if to use column names
      • getUseColumnNamesAsClassLabels

        public boolean getUseColumnNamesAsClassLabels()
        Returns whether to use the names of the class distribution columns as labels in the fake evaluation.
        Returns:
        true if to use column names
      • useColumnNamesAsClassLabelsTipText

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

        public void setWeight​(SpreadSheetColumnIndex value)
        Sets the (optional) column with the instance weight values.
        Parameters:
        value - the column
      • getWeight

        public SpreadSheetColumnIndex getWeight()
        Returns the (optional) column with the instance weight values.
        Returns:
        the column
      • weightTipText

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

        public void setSortLabels​(boolean value)
        Sets whether to sort the labels with the specified comparator.
        Parameters:
        value - true if to sort
      • getSortLabels

        public boolean getSortLabels()
        Returns whether to store the labels with the specified comparator.
        Returns:
        true if to sort
      • sortLabelsTipText

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

        public void setComparator​(Comparator value)
        Sets the comparator to use.
        Parameters:
        value - the comparator
      • getComparator

        public Comparator getComparator()
        Returns the comparator to use.
        Returns:
        the comparator
      • comparatorTipText

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

        public void setReverse​(boolean value)
        Sets whether to reverse the sorting.
        Parameters:
        value - true if to reverse
      • getReverse

        public boolean getReverse()
        Returns whether to reverse the sorting.
        Returns:
        true if to reverse
      • reverseTipText

        public String reverseTipText()
        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.
        Specified by:
        accepts in interface InputConsumer
        Returns:
        the Class of objects that can be processed
      • generates

        public Class[] generates()
        Returns the class of objects that it generates.
        Specified by:
        generates in interface OutputProducer
        Returns:
        the Class of the generated tokens
      • doExecute

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