weka.filters.unsupervised.attribute

## Class MergeInfrequentNominalValues

- java.lang.Object
- - weka.filters.Filter
  - - weka.filters.SimpleFilter
    - - weka.filters.SimpleBatchFilter
      - - weka.filters.unsupervised.attribute.MergeInfrequentNominalValues

- All Implemented Interfaces:
    java.io.Serializable, CapabilitiesHandler, CapabilitiesIgnorer, CommandlineRunnable, OptionHandler, RevisionHandler, WeightedAttributesHandler, WeightedInstancesHandler, UnsupervisedFilter

      public class MergeInfrequentNominalValues
      extends SimpleBatchFilter
      implements UnsupervisedFilter, WeightedAttributesHandler, WeightedInstancesHandler

  Merges all values of the specified nominal attributes that are insufficiently frequent.

  Valid options are:

       -N <int>
        The minimum frequency for a value to remain (default: 2).

       -R <range>
        Sets list of attributes to act on (or its inverse). 'first and 'last' are accepted as well.'
        E.g.: first-5,7,9,20-last
        (default: 1,2)

       -V
        Invert matching sense (i.e. act on all attributes not specified in list)

       -S
        Use short IDs for merged attribute values.

       -output-debug-info
        If set, filter is run in debug mode and
        may output additional info to the console

       -do-not-check-capabilities
        If set, filter capabilities are not checked before filter is built
        (use with caution).

  Version:
    $Revision: ???? $
  Author:
    Eibe Frank
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MergeInfrequentNominalValues()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `allowAccessToFullInputFormat()` We need access to the full input data in determineOutputFormat.
    `java.lang.String` | `attributeIndicesTipText()` Returns the tip text for this property
    `java.lang.String` | `getAttributeIndices()` Get the current range selection.
    `Capabilities` | `getCapabilities()` Returns the Capabilities of this filter.
    `boolean` | `getInvertSelection()` Get whether the supplied attributes are to be acted on or all other attributes.
    `int` | `getMinimumFrequency()` Gets the minimum frequency.
    `java.lang.String[]` | `getOptions()` Gets the current settings of the filter.
    `java.lang.String` | `getRevision()` Returns the revision string.
    `boolean` | `getUseShortIDs()` Get whether short IDs are to be used.
    `java.lang.String` | `globalInfo()` Returns a string describing this filter.
    `java.lang.String` | `invertSelectionTipText()` Returns the tip text for this property
    `java.util.Enumeration<Option>` | `listOptions()` Returns an enumeration describing the available options.
    `static void` | `main(java.lang.String[] args)` runs the filter with the given arguments
    `java.lang.String` | `minimumFrequencyTipText()` Returns the tip text for this property
    `void` | `setAttributeIndices(java.lang.String rangeList)` Set which attributes are to be acted on (or not, if invert is true)
    `void` | `setAttributeIndicesArray(int[] attributes)` Set which attributes are to be acted on (or not, if invert is true)
    `void` | `setInvertSelection(boolean invert)` Set whether selected attributes should be acted on or all other attributes.
    `void` | `setMinimumFrequency(int minF)` Sets the minimum frequency.
    `void` | `setOptions(java.lang.String[] options)` Parses a given list of options.
    `void` | `setUseShortIDs(boolean m_UseShortIDs)` Sets whether short IDs are to be used.
    `java.lang.String` | `useShortIDsTipText()` Returns the tip text for this property

    - ### Methods inherited from class weka.filters.SimpleBatchFilter

      `batchFinished, input, input`

    - ### Methods inherited from class weka.filters.SimpleFilter

      `setInputFormat`

    - ### Methods inherited from class weka.filters.Filter

      `batchFilterFile, debugTipText, doNotCheckCapabilitiesTipText, filterFile, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, getOutputFormat, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputPeek, postExecution, preExecution, run, runFilter, setDebug, setDoNotCheckCapabilities, toString, useFilter, wekaStaticWrapper`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### MergeInfrequentNominalValues

          public MergeInfrequentNominalValues()

  - ### Method Detail

    - #### globalInfo

          public java.lang.String globalInfo()

      Returns a string describing this filter.
      Specified by:
        `globalInfo` in class `SimpleFilter`
      Returns:
        a description of the filter suitable for displaying in the explorer/experimenter gui

    - #### listOptions

          public java.util.Enumeration<Option> listOptions()

      Returns an enumeration describing the available options.
      Specified by:
        `listOptions` in interface `OptionHandler`
      Overrides:
        `listOptions` in class `Filter`
      Returns:
        an enumeration of all the available options.

    - #### getOptions

          public java.lang.String[] getOptions()

      Gets the current settings of the filter.
      Specified by:
        `getOptions` in interface `OptionHandler`
      Overrides:
        `getOptions` in class `Filter`
      Returns:
        an array of strings suitable for passing to setOptions

    - #### setOptions

          public void setOptions(java.lang.String[] options)
                          throws java.lang.Exception

      Parses a given list of options.

      Valid options are:

           -N <int>
            The minimum frequency for a value to remain (default: 2).

           -R <range>
            Sets list of attributes to act on (or its inverse). 'first and 'last' are accepted as well.'
            E.g.: first-5,7,9,20-last
            (default: 1,2)

           -V
            Invert matching sense (i.e. act on all attributes not specified in list)

           -S
            Use short IDs for merged attribute values.

           -output-debug-info
            If set, filter is run in debug mode and
            may output additional info to the console

           -do-not-check-capabilities
            If set, filter capabilities are not checked before filter is built
            (use with caution).

      Specified by:
        `setOptions` in interface `OptionHandler`
      Overrides:
        `setOptions` in class `Filter`
      Parameters:
        `options` - the list of options as an array of strings
      Throws:
        `java.lang.Exception` - if an option is not supported

    - #### minimumFrequencyTipText

          public java.lang.String minimumFrequencyTipText()

      Returns the tip text for this property
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### getMinimumFrequency

          public int getMinimumFrequency()

      Gets the minimum frequency.
      Returns:
        int the minimum frequency.

    - #### setMinimumFrequency

          public void setMinimumFrequency(int minF)

      Sets the minimum frequency.
      Parameters:
        `minF` - the minimum frequency as an integer.

    - #### attributeIndicesTipText

          public java.lang.String attributeIndicesTipText()

      Returns the tip text for this property
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### getAttributeIndices

          public java.lang.String getAttributeIndices()

      Get the current range selection.
      Returns:
        a string containing a comma separated list of ranges

    - #### setAttributeIndices

          public void setAttributeIndices(java.lang.String rangeList)

      Set which attributes are to be acted on (or not, if invert is true)
      Parameters:
        `rangeList` - a string representing the list of attributes. Since the string will typically come from a user, attributes are indexed from 1.
        eg: first-3,5,6-last

    - #### setAttributeIndicesArray

          public void setAttributeIndicesArray(int[] attributes)

      Set which attributes are to be acted on (or not, if invert is true)
      Parameters:
        `attributes` - an array containing indexes of attributes to select. Since the array will typically come from a program, attributes are indexed from 0.

    - #### invertSelectionTipText

          public java.lang.String invertSelectionTipText()

      Returns the tip text for this property
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### getInvertSelection

          public boolean getInvertSelection()

      Get whether the supplied attributes are to be acted on or all other attributes.
      Returns:
        true if the supplied attributes will be kept

    - #### setInvertSelection

          public void setInvertSelection(boolean invert)

      Set whether selected attributes should be acted on or all other attributes.
      Parameters:
        `invert` - the new invert setting

    - #### useShortIDsTipText

          public java.lang.String useShortIDsTipText()

      Returns the tip text for this property
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### getUseShortIDs

          public boolean getUseShortIDs()

      Get whether short IDs are to be used.
      Returns:
        true if short IDs are to be used.

    - #### setUseShortIDs

          public void setUseShortIDs(boolean m_UseShortIDs)

      Sets whether short IDs are to be used.
      Parameters:
        `m_UseShortIDs` - if true, short IDs will be used

    - #### allowAccessToFullInputFormat

          public boolean allowAccessToFullInputFormat()

      We need access to the full input data in determineOutputFormat.
      Overrides:
        `allowAccessToFullInputFormat` in class `SimpleBatchFilter`
      Returns:
        whether determineOutputFormat has access to the full input dataset

    - #### getCapabilities

          public Capabilities getCapabilities()

      Returns the Capabilities of this filter.
      Specified by:
        `getCapabilities` in interface `CapabilitiesHandler`
      Overrides:
        `getCapabilities` in class `Filter`
      Returns:
        the capabilities of this object
      See Also:
        `Capabilities`

    - #### getRevision

          public java.lang.String getRevision()

      Returns the revision string.
      Specified by:
        `getRevision` in interface `RevisionHandler`
      Overrides:
        `getRevision` in class `Filter`
      Returns:
        the revision

    - #### main

          public static void main(java.lang.String[] args)

      runs the filter with the given arguments
      Parameters:
        `args` - the commandline arguments