Class ReplaceMissingWithUserConstant

    • Constructor Detail

      • ReplaceMissingWithUserConstant

        public ReplaceMissingWithUserConstant()
    • Method Detail

      • globalInfo

        public java.lang.String globalInfo()
        Returns a string describing this filter
        Returns:
        a description of the filter suitable for displaying in the explorer/experimenter gui
      • setOptions

        public void setOptions​(java.lang.String[] options)
                        throws java.lang.Exception
        Parses a given list of options.

        Valid options are:

         -A <index1,index2-index4,... | att-name1,att-name2,...>
          Specify list of attributes to replace missing values for 
          (as weka range list of indices or a comma separated list of attribute names).
          (default: consider all attributes)
         
         -N
          Specify the replacement constant for nominal/string attributes
         
         -R
          Specify the replacement constant for numeric attributes
          (default: 0)
         
         -D
          Specify the replacement constant for date attributes
         
         -F
          Specify the date format for parsing the replacement date constant
          (default: yyyy-MM-dd'T'HH:mm:ss)
         
         -unset-class-temporarily
          Unsets the class index temporarily before the filter is
          applied to the data.
          (default: no)
         
        Specified by:
        setOptions in interface OptionHandler
        Overrides:
        setOptions in class PotentialClassIgnorer
        Parameters:
        options - the list of options as an array of strings
        Throws:
        java.lang.Exception - if an option is not supported
      • attributesTipText

        public java.lang.String attributesTipText()
        Tip text for this property suitable for displaying in the GUI.
        Returns:
        the tip text for this property.
      • setAttributes

        public void setAttributes​(java.lang.String range)
        Set the list of attributes to consider for replacing missing values
        Parameters:
        range - the list of attributes to consider
      • getAttributes

        public java.lang.String getAttributes()
        Get the list of attributes to consider for replacing missing values
        Returns:
        the list of attributes to consider
      • nominalStringReplacementValueTipText

        public java.lang.String nominalStringReplacementValueTipText()
        Tip text for this property suitable for displaying in the GUI.
        Returns:
        the tip text for this property.
      • getNominalStringReplacementValue

        public java.lang.String getNominalStringReplacementValue()
        Get the nominal/string replacement value
        Returns:
        the nominal/string replacement value
      • setNominalStringReplacementValue

        public void setNominalStringReplacementValue​(java.lang.String nominalStringConstant)
        Set the nominal/string replacement value
        Parameters:
        nominalStringConstant - the nominal/string constant to use
      • numericReplacementValueTipText

        public java.lang.String numericReplacementValueTipText()
        Tip text for this property suitable for displaying in the GUI.
        Returns:
        the tip text for this property.
      • getNumericReplacementValue

        public java.lang.String getNumericReplacementValue()
        Get the numeric replacement value
        Returns:
        the numeric replacement value
      • setNumericReplacementValue

        public void setNumericReplacementValue​(java.lang.String numericConstant)
        Set the numeric replacement value
        Parameters:
        numericConstant - the numeric replacement value
      • dateReplacementValueTipText

        public java.lang.String dateReplacementValueTipText()
        Tip text for this property suitable for displaying in the GUI.
        Returns:
        the tip text for this property.
      • setDateReplacementValue

        public void setDateReplacementValue​(java.lang.String dateConstant)
        Set the date replacement value
        Parameters:
        dateConstant - the date replacement value
      • getDateReplacementValue

        public java.lang.String getDateReplacementValue()
        Get the date replacement value
        Returns:
        the date replacement value
      • dateFormatTipText

        public java.lang.String dateFormatTipText()
        Tip text for this property suitable for displaying in the GUI.
        Returns:
        the tip text for this property.
      • setDateFormat

        public void setDateFormat​(java.lang.String dateFormat)
        Set the date format to use for parsing the date replacement constant
        Parameters:
        dateFormat - the date format to use
      • getDateFormat

        public java.lang.String getDateFormat()
        Get the date format to use for parsing the date replacement constant
        Returns:
        the date format to use
      • setInputFormat

        public boolean setInputFormat​(Instances instanceInfo)
                               throws java.lang.Exception
        Description copied from class: PotentialClassIgnorer
        Sets the format of the input instances. If the filter is able to determine the output format before seeing any input instances, it does so here. This default implementation clears the output format and output queue, and the new batch flag is set. Overriders should call super.setInputFormat(Instances)
        Overrides:
        setInputFormat in class PotentialClassIgnorer
        Parameters:
        instanceInfo - an Instances object containing the input instance structure (any instances contained in the object are ignored - only the structure is required).
        Returns:
        true if the outputFormat may be collected immediately
        Throws:
        java.lang.Exception - if the inputFormat can't be set successfully
      • input

        public boolean input​(Instance inst)
                      throws java.lang.Exception
        Description copied from class: Filter
        Input an instance for filtering. Ordinarily the instance is processed and made available for output immediately. Some filters require all instances be read before producing output, in which case output instances should be collected after calling batchFinished(). If the input marks the start of a new batch, the output queue is cleared. This default implementation assumes all instance conversion will occur when batchFinished() is called.
        Overrides:
        input in class Filter
        Parameters:
        inst - the input instance
        Returns:
        true if the filtered instance may now be collected with output().
        Throws:
        java.lang.NullPointerException - if the input format has not been defined.
        java.lang.Exception - if the input instance was not of the correct format or if there was a problem with the filtering.
      • main

        public static void main​(java.lang.String[] args)
        Main method for testing this class.
        Parameters:
        args - should contain arguments to the filter: use -h for help