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 Description OrdinalToNumeric()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAttributesToOperateOn()Get the attributes to operate onCapabilitiesgetCapabilities()Returns the Capabilities of this filter.java.lang.String[]getOptions()Gets the current settings of the filter.java.lang.StringgetRevision()Returns the revision string.java.lang.StringglobalInfo()Returns a string describing this filterbooleaninput(Instance inst)Input an instance for filtering.java.util.Enumeration<Option>listOptions()Returns an enumeration describing the available options.static voidmain(java.lang.String[] args)Main method for testing this class.voidsetAttributesToOperateOn(java.lang.String atts)Set the attributes to operate onvoidsetEnvironment(Environment env)Set environment to usebooleansetInputFormat(Instances instancesInfo)Sets the format of the input instances.voidsetOptions(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
-
-
-
-
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:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classFilter- 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:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classPotentialClassIgnorer- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.ExceptionParses 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:
java.lang.Exception- if an option is not supported
-
getOptions
public java.lang.String[] 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(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:
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:
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:
inputin classFilter- 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:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classFilter- Returns:
- the revision
-
setEnvironment
public void setEnvironment(Environment env)
Set environment to use- Specified by:
setEnvironmentin interfaceEnvironmentHandler- 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
-
-