com.rapidminer.operator.preprocessing.filter
Class NumericToFormattedNominal

java.lang.Object
  extended by com.rapidminer.operator.Operator
      extended by com.rapidminer.operator.AbstractExampleSetProcessing
          extended by com.rapidminer.operator.preprocessing.AbstractDataProcessing
              extended by com.rapidminer.operator.preprocessing.filter.NumericToNominal
                  extended by com.rapidminer.operator.preprocessing.filter.NumericToFormattedNominal
All Implemented Interfaces:
ConfigurationListener, PreviewListener, ParameterHandler, LoggingHandler

public class NumericToFormattedNominal
extends NumericToNominal

This operator tries to parse numerical values and formats them in the specified number format. It also supports different kinds of numbers, including integers (123), fixed-point numbers (123.4), scientific notation (1.23E4), percentages (12%), and currency amounts ($123). The format type parameter specifies the basic format, in all cases but for "pattern" the specified locale will be used. In case of pattern the locale is ignored and the specified pattern is used instead.

Please note that this operator only works on numerical attributes and the result will be in any case a nominal attribute no matter if the resulting format would again be a parsable number.

In case of the pattern format type, a pattern parameter is used to define the format. If two different formats for positive and negative numbers should be used, those formats can be defined by a separating ';'. The pattern must have the following structure:

pattern := subpattern{;subpattern}
subpattern := {prefix}integer{.fraction}{suffix}
prefix := any character combination including white space
suffix := any character combination including white space
integer := '#'* '0'* '0'
fraction := '0'* '#'*

The following placeholders can be used within the pattern parameter:

0   a digit
#   a digit, zero shows as absent
.   placeholder for decimal separator
,   placeholder for grouping separator.
E   separates mantissa and exponent for exponential formats.
-   default negative prefix.
%   multiply by 100 and show as percentage
X   any other characters can be used in the prefix or suffix
'   used to quote special characters in a prefix or suffix.

Author:
Mierswa

Field Summary
static java.lang.String[] availableLocaleNames
           
static java.util.List<java.util.Locale> availableLocales
           
static int defaultLocale
           
static int FORMAT_TYPE_CURRENCY
           
static int FORMAT_TYPE_INTEGER
           
static int FORMAT_TYPE_NUMBER
           
static int FORMAT_TYPE_PATTERN
           
static int FORMAT_TYPE_PERCENT
           
static java.lang.String[] FORMAT_TYPES
           
static java.lang.String PARAMETER_FORMAT_TYPE
           
static java.lang.String PARAMETER_LOCALE
           
static java.lang.String PARAMETER_PATTERN
           
static java.lang.String PARAMETER_USE_GROUPING
           
 
Constructor Summary
NumericToFormattedNominal(OperatorDescription description)
           
 
Method Summary
 void cleanUp()
          Will be invoked after the setValue method was invoked for each example.
protected  int getGeneratedAttributevalueType()
          Returns Ontology.NOMINAL or one of its subtypes.
 java.util.List<ParameterType> getParameterTypes()
          Returns a list of ParameterTypes describing the parameters of this operator.
 void init()
          Will be invoked before the setValue method is invoked for each example.
protected  void setValue(Example example, Attribute newAttribute, double value)
           
 
Methods inherited from class com.rapidminer.operator.preprocessing.filter.NumericToNominal
apply, makeAttribute
 
Methods inherited from class com.rapidminer.operator.AbstractExampleSetProcessing
apply, getInputClasses, getOutputClasses
 
Methods inherited from class com.rapidminer.operator.Operator
addError, addValue, addWarning, apply, checkDeprecations, checkForStop, checkIO, checkProperties, clearErrorList, cloneOperator, createExperimentTree, createExperimentTree, createFromXML, createMarkedExperimentTree, createMarkedProcessTree, createProcessTree, createProcessTree, getAddOnlyAdditionalOutput, getApplyCount, getDeliveredOutputClasses, getDeprecationInfo, getDesiredInputClasses, getEncoding, getErrorList, getExperiment, getInnerOperatorsXML, getInput, getInput, getInput, getInputDescription, getIOContainerForInApplyLoopBreakpoint, getIODescription, getLog, getName, getOperatorClassName, getOperatorDescription, getParameter, getParameterAsBoolean, getParameterAsColor, getParameterAsDouble, getParameterAsFile, getParameterAsFile, getParameterAsInputStream, getParameterAsInt, getParameterAsMatrix, getParameterAsString, getParameterList, getParameters, getParameterType, getParent, getProcess, getStartTime, getStatus, getUserDescription, getValue, getValues, getXML, hasBreakpoint, hasBreakpoint, hasInput, inApplyLoop, isDebugMode, isEnabled, isExpanded, isParallel, isParameterSet, log, logError, logNote, logWarning, performAdditionalChecks, processFinished, processStarts, register, registerOperator, remove, rename, resume, setApplyCount, setBreakpoint, setEnabled, setExpanded, setInput, setListParameter, setOperatorParameters, setParameter, setParameters, setParent, setUserDescription, toString, unregisterOperator, writeXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAMETER_FORMAT_TYPE

public static final java.lang.String PARAMETER_FORMAT_TYPE
See Also:
Constant Field Values

PARAMETER_PATTERN

public static final java.lang.String PARAMETER_PATTERN
See Also:
Constant Field Values

PARAMETER_LOCALE

public static final java.lang.String PARAMETER_LOCALE
See Also:
Constant Field Values

PARAMETER_USE_GROUPING

public static final java.lang.String PARAMETER_USE_GROUPING
See Also:
Constant Field Values

FORMAT_TYPES

public static final java.lang.String[] FORMAT_TYPES

FORMAT_TYPE_NUMBER

public static final int FORMAT_TYPE_NUMBER
See Also:
Constant Field Values

FORMAT_TYPE_INTEGER

public static final int FORMAT_TYPE_INTEGER
See Also:
Constant Field Values

FORMAT_TYPE_CURRENCY

public static final int FORMAT_TYPE_CURRENCY
See Also:
Constant Field Values

FORMAT_TYPE_PERCENT

public static final int FORMAT_TYPE_PERCENT
See Also:
Constant Field Values

FORMAT_TYPE_PATTERN

public static final int FORMAT_TYPE_PATTERN
See Also:
Constant Field Values

availableLocales

public static java.util.List<java.util.Locale> availableLocales

availableLocaleNames

public static java.lang.String[] availableLocaleNames

defaultLocale

public static int defaultLocale
Constructor Detail

NumericToFormattedNominal

public NumericToFormattedNominal(OperatorDescription description)
Method Detail

init

public void init()
          throws OperatorException
Description copied from class: NumericToNominal
Will be invoked before the setValue method is invoked for each example. This default implementation does nothing.

Overrides:
init in class NumericToNominal
Throws:
OperatorException

cleanUp

public void cleanUp()
             throws OperatorException
Description copied from class: NumericToNominal
Will be invoked after the setValue method was invoked for each example. This default implementation does nothing.

Overrides:
cleanUp in class NumericToNominal
Throws:
OperatorException

setValue

protected void setValue(Example example,
                        Attribute newAttribute,
                        double value)
Specified by:
setValue in class NumericToNominal

getParameterTypes

public java.util.List<ParameterType> getParameterTypes()
Description copied from class: Operator
Returns a list of ParameterTypes describing the parameters of this operator. The default implementation returns an empty list if no input objects can be retained and special parameters for those input objects which can be prevented from being consumed.

Specified by:
getParameterTypes in interface ParameterHandler
Overrides:
getParameterTypes in class Operator

getGeneratedAttributevalueType

protected int getGeneratedAttributevalueType()
Description copied from class: NumericToNominal
Returns Ontology.NOMINAL or one of its subtypes.

Specified by:
getGeneratedAttributevalueType in class NumericToNominal


Copyright © 2001-2009 by Rapid-I