Class ReplacingMissingValuesFilter

  • All Implemented Interfaces:
    Configurable, Serializable, CapabilitiesHandler, MOAObject, OptionHandler, ExampleStream, StreamFilter

    public class ReplacingMissingValuesFilter
    extends AbstractStreamFilter
    Replaces the missing values with another value according to the selected strategy. Available strategies for numerical attributes are: 1. Nothing: Does nothing (doesn't replace missing values) 2. LastKnownValue: Replaces with the last non missing value 3. Mean: Replaces with mean of the processed instances so far 4. Max: Replaces with maximum of the processed instances so far 5. Min: Replaces with minimum of the processed instances so far 6. Constant: Replaces with a constant value (default: zero) Available strategies for nominal attributes are: 1. Nothing: Does nothing (doesn't replace missing values) 2. LastKnownValue: Replaces with the last non missing value 3. Mode: Replaces with the mode of the processed instances so far (most frequent value) Beware of numerical strategies 2 to 5: if no previous non-missing values were processed, missing values will be replaced by 0.
    Author:
    Manuel Martin Salvador <draxus@gmail.com>
    See Also:
    Serialized Form
    • Field Detail

      • numericReplacementStrategyOption

        public MultiChoiceOption numericReplacementStrategyOption
      • nominalReplacementStrategyOption

        public MultiChoiceOption nominalReplacementStrategyOption
      • numericalConstantValueOption

        public FloatOption numericalConstantValueOption
      • numAttributes

        protected int numAttributes
      • columnsStatistics

        protected double[] columnsStatistics
      • numberOfSamples

        protected long[] numberOfSamples
      • lastNominalValues

        protected double[] lastNominalValues
      • numericalSelectedStrategy

        protected int numericalSelectedStrategy
      • nominalSelectedStrategy

        protected int nominalSelectedStrategy
    • Constructor Detail

      • ReplacingMissingValuesFilter

        public ReplacingMissingValuesFilter()
    • Method Detail

      • getHeader

        public InstancesHeader getHeader()
        Description copied from interface: ExampleStream
        Gets the header of this stream. This is useful to know attributes and classes. InstancesHeader is an extension of weka.Instances.
        Returns:
        the header of this stream
      • getDescription

        public void getDescription​(StringBuilder sb,
                                   int indent)
        Description copied from interface: MOAObject
        Returns a string representation of this object. Used in AbstractMOAObject.toString to give a string representation of the object.
        Parameters:
        sb - the stringbuilder to add the description
        indent - the number of characters to indent
      • restartImpl

        protected void restartImpl()
        Description copied from class: AbstractStreamFilter
        Restarts this filter. All instances that extends from AbstractStreamFilter must implement restartImpl. restart uses restartImpl in AbstractStreamFilter.
        Specified by:
        restartImpl in class AbstractStreamFilter