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
Constructors -
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 filterbooleanInput an instance for filtering.Returns an enumeration describing the available options.static voidMain method for testing this class.voidSet the attributes to operate onvoidSet environment to usebooleansetInputFormat(Instances instancesInfo) Sets the format of the input instances.voidsetOptions(String[] options) Parses a list of options for this object.Methods inherited from class weka.filters.unsupervised.attribute.PotentialClassIgnorer
getIgnoreClass, getOutputFormat, ignoreClassTipText, setIgnoreClassMethods 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:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classFilter- Returns:
- the capabilities of this object
- See Also:
-
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classPotentialClassIgnorer- Returns:
- an enumeration of all the available options.
-
setOptions
Parses a list of options for this object.- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin 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:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin 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:
setInputFormatin 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:
inputin 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:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classFilter- Returns:
- the revision
-
setEnvironment
Set environment to use- Specified by:
setEnvironmentin 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
-