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:
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:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the attributes to operate onReturns the Capabilities of this filter.String[]
Gets the current settings of the filter.Returns the revision string.Returns a string describing this filterboolean
Input an instance for filtering.Returns an enumeration describing the available options.static void
Main method for testing this class.void
Set the attributes to operate onvoid
Set environment to useboolean
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
-
Constructor Details
-
OrdinalToNumeric
public OrdinalToNumeric()
-
-
Method Details
-
globalInfo
Returns a string describing this filter- Returns:
- a description of the filter suitable for displaying in the explorer/experimenter gui
-
getCapabilities
Returns the Capabilities of this filter.- Specified by:
getCapabilities
in interfaceCapabilitiesHandler
- Overrides:
getCapabilities
in classFilter
- Returns:
- the capabilities of this object
- See Also:
-
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceOptionHandler
- Overrides:
listOptions
in classPotentialClassIgnorer
- Returns:
- an enumeration of all the available options.
-
setOptions
Parses a list of options for this object.- Specified by:
setOptions
in interfaceOptionHandler
- Overrides:
setOptions
in classPotentialClassIgnorer
- Parameters:
options
- the list of options as an array of strings- Throws:
Exception
- if an option is not supported
-
getOptions
Gets the current settings of the filter.- Specified by:
getOptions
in interfaceOptionHandler
- Overrides:
getOptions
in classPotentialClassIgnorer
- 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
Get the attributes to operate on- Returns:
- a range of 1-based indexes or a comma-separated list of attribute names
-
setInputFormat
Sets the format of the input instances.- Overrides:
setInputFormat
in classPotentialClassIgnorer
- 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
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 classFilter
- 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
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classFilter
- Returns:
- the revision
-
setEnvironment
Set environment to use- Specified by:
setEnvironment
in interfaceEnvironmentHandler
- Parameters:
env
- the environment variables to
-
main
Main method for testing this class.- Parameters:
args
- should contain arguments to the filter: use -h for help
-