Package 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:
  `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
  Description
  `OrdinalToNumeric()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getAttributesToOperateOn()`
  Get the attributes to operate on
  `Capabilities`
  `getCapabilities()`
  Returns the Capabilities of this filter.
  `String[]`
  `getOptions()`
  Gets the current settings of the filter.
  `String`
  `getRevision()`
  Returns the revision string.
  `String`
  `globalInfo()`
  Returns a string describing this filter
  `boolean`
  `input(Instance inst)`
  Input an instance for filtering.
  `Enumeration<Option>`
  `listOptions()`
  Returns an enumeration describing the available options.
  `static void`
  `main(String[] args)`
  Main method for testing this class.
  `void`
  `setAttributesToOperateOn(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(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 Details

  - ### OrdinalToNumeric

    public OrdinalToNumeric()

- ## Method Details

  - ### globalInfo

    public 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 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(String[] options) throws 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:
      `Exception` - if an option is not supported

  - ### getOptions

    public 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(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 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 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:
      `Exception` - if the input format can't be set successfully

  - ### input

    public boolean input(Instance inst) throws 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:
      `IllegalStateException` - if no input format has been defined.
      `NullPointerException` - if the input format has not been defined.
      `Exception` - if the input instance was not of the correct format or if there was a problem with the filtering.

  - ### getRevision

    public 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(String[] args)
    Main method for testing this class.
    Parameters:
      `args` - should contain arguments to the filter: use -h for help