weka.filters.unsupervised.attribute

## Class OrdinalToNumeric

- java.lang.Object
- - weka.filters.Filter
  - - weka.filters.unsupervised.attribute.PotentialClassIgnorer
    - - weka.filters.unsupervised.attribute.OrdinalToNumeric

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

      public class OrdinalToNumeric
      extends PotentialClassIgnorer
      implements StreamableFilter, UnsupervisedFilter, EnvironmentHandler, WeightedAttributesHandler, WeightedInstancesHandler

  An attribute filter that converts ordinal nominal attributes into numeric ones
  Valid options are:

       -unset-class-temporarily
        Unsets the class index temporarily before the filter is
        applied to the data.
        (default: no)

       -R <range or list of names>
        Attributes to operate on. Can be a 1-based index range of indices, or a comma-separated list of names.
        (default: first-last)

  Version:
    $Revision: $
  Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OrdinalToNumeric()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getAttributesToOperateOn()` Get the attributes to operate on
    `Capabilities` | `getCapabilities()` Returns the Capabilities of this filter.
    `java.lang.String[]` | `getOptions()` Gets the current settings of the filter.
    `java.lang.String` | `getRevision()` Returns the revision string.
    `java.lang.String` | `globalInfo()` Returns a string describing this filter
    `boolean` | `input(Instance inst)` Input an instance for filtering.
    `java.util.Enumeration<Option>` | `listOptions()` Returns an enumeration describing the available options.
    `static void` | `main(java.lang.String[] args)` Main method for testing this class.
    `void` | `setAttributesToOperateOn(java.lang.String atts)` Set the attributes to operate on
    `void` | `setEnvironment(Environment env)` Set environment to use
    `boolean` | `setInputFormat(Instances instancesInfo)` Sets the format of the input instances.
    `void` | `setOptions(java.lang.String[] options)` Parses a list of options for this object.

    - ### Methods inherited from class weka.filters.unsupervised.attribute.PotentialClassIgnorer

      `getIgnoreClass, getOutputFormat, ignoreClassTipText, setIgnoreClass`

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

      `batchFilterFile, batchFinished, debugTipText, doNotCheckCapabilitiesTipText, filterFile, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, 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

    - #### OrdinalToNumeric

          public OrdinalToNumeric()

  - ### 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

    - #### 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`

    - #### listOptions

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

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

    - #### setOptions

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

      Parses a list of options for this object.
      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

    - #### getOptions

          public java.lang.String[] getOptions()

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

    - #### setAttributesToOperateOn

          @OptionMetadata(displayName="Attributes to operate on",
                          description="Attributes to operate on. Can be a 1-based index range of indices or a comma-separated list of names",
                          commandLineParamName="R",
                          commandLineParamSynopsis="-R <range or list of names>",
                          displayOrder=1)
          public void setAttributesToOperateOn(java.lang.String atts)

      Set the attributes to operate on
      Parameters:
        `atts` - a range of 1-based indexes or a comma-separated list of attribute names

    - #### getAttributesToOperateOn

          public java.lang.String getAttributesToOperateOn()

      Get the attributes to operate on
      Returns:
        a range of 1-based indexes or a comma-separated list of attribute names

    - #### setInputFormat

          public boolean setInputFormat(Instances instancesInfo)
                                 throws java.lang.Exception

      Sets the format of the input instances.
      Overrides:
        `setInputFormat` in class `PotentialClassIgnorer`
      Parameters:
        `instancesInfo` - 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 input format can't be set successfully

    - #### input

          public boolean input(Instance inst)
                        throws java.lang.Exception

      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.
      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.IllegalStateException` - if no input format has been defined.
        `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.

    - #### getRevision

          public java.lang.String getRevision()

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

    - #### setEnvironment

          public void setEnvironment(Environment env)

      Set environment to use
      Specified by:
        `setEnvironment` in interface `EnvironmentHandler`
      Parameters:
        `env` - the environment variables to

    - #### 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