com.rapidminer.operator.preprocessing.filter
Class AttributeValueMapper

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.AttributeValueMapper
All Implemented Interfaces:
ConfigurationListener, PreviewListener, ParameterHandler, LoggingHandler

public class AttributeValueMapper
extends AbstractDataProcessing

This operator takes an ExampleSet as input and maps the values of certain attributes to other values. The operator can replace nominal values (e.g. replace the value "green" by the value "green_color") as well as numerical values (e.g. replace the all values "3" by "-1"). A single mapping can be specified using the parameters replace_what and replace_by. Multiple mappings can be specified in the parameter list value_mappings.

Additionally, the operator allows to define (and consider) a default mapping. If add_default_mapping is set to true and default_value is properly set, all values that occur in the example set but are not listed in the value mappings list are replaced by the default value. This may be helpful in cases where only some values should be mapped explicitly and many unimportant values should be mapped to a default value (e.g. "other").

If the parameter consider_regular_expressions is enabled, the values are replaced by the new values if the original values match the given regular expressions. The value corresponding to the first matching regular expression in the mappings list is taken as replacement.

This operator supports regular expressions for the attribute names, i.e. the value mapping is applied on all attributes for which the name fulfills the pattern defined by the name expression.

Author:
Tobias Malbrecht

Field Summary
static java.lang.String PARAMETER_ADD_DEFAULT_MAPPING
          The parameter name for "If set to true, all original values which are not listed in the value mappings list are mapped to the default value.
static java.lang.String PARAMETER_APPLY_TO_SPECIAL_FEATURES
          The parameter name for "Filter also special attributes (label, id...)
static java.lang.String PARAMETER_ATTRIBUTES
          The parameter name for "The specified values will be merged in all attributes specified by the given regular expression.
static java.lang.String PARAMETER_CONSIDER_REGULAR_EXPRESSIONS
          The parameter name for "Enables matching based on regular expressions; original values may be specified as regular expressions.
static java.lang.String PARAMETER_DEFAULT_VALUE
          The parameter name for "The default value all original values are mapped to, if add_default_mapping is set to true.
static java.lang.String PARAMETER_OLD_VALUES
          The parameter name for "The second value which should be merged.
static java.lang.String PARAMETER_REPLACE_BY
          The parameter name for "The new attribute value to use.
static java.lang.String PARAMETER_REPLACE_WHAT
          The parameter name for "All occurrences of this value will be replaced.
static java.lang.String PARAMETER_VALUE_MAPPINGS
          The parameter name for "The first value which should be merged.
 
Constructor Summary
AttributeValueMapper(OperatorDescription description)
           
 
Method Summary
 ExampleSet apply(ExampleSet exampleSet)
          Delegate for the apply method.
 java.util.List<ParameterType> getParameterTypes()
          Returns a list of ParameterTypes describing the parameters of this operator.
 
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_ATTRIBUTES

public static final java.lang.String PARAMETER_ATTRIBUTES
The parameter name for "The specified values will be merged in all attributes specified by the given regular expression."

See Also:
Constant Field Values

PARAMETER_APPLY_TO_SPECIAL_FEATURES

public static final java.lang.String PARAMETER_APPLY_TO_SPECIAL_FEATURES
The parameter name for "Filter also special attributes (label, id...)"

See Also:
Constant Field Values

PARAMETER_VALUE_MAPPINGS

public static final java.lang.String PARAMETER_VALUE_MAPPINGS
The parameter name for "The first value which should be merged."

See Also:
Constant Field Values

PARAMETER_OLD_VALUES

public static final java.lang.String PARAMETER_OLD_VALUES
The parameter name for "The second value which should be merged."

See Also:
Constant Field Values

PARAMETER_REPLACE_WHAT

public static final java.lang.String PARAMETER_REPLACE_WHAT
The parameter name for "All occurrences of this value will be replaced."

See Also:
Constant Field Values

PARAMETER_REPLACE_BY

public static final java.lang.String PARAMETER_REPLACE_BY
The parameter name for "The new attribute value to use."

See Also:
Constant Field Values

PARAMETER_CONSIDER_REGULAR_EXPRESSIONS

public static final java.lang.String PARAMETER_CONSIDER_REGULAR_EXPRESSIONS
The parameter name for "Enables matching based on regular expressions; original values may be specified as regular expressions."

See Also:
Constant Field Values

PARAMETER_ADD_DEFAULT_MAPPING

public static final java.lang.String PARAMETER_ADD_DEFAULT_MAPPING
The parameter name for "If set to true, all original values which are not listed in the value mappings list are mapped to the default value."

See Also:
Constant Field Values

PARAMETER_DEFAULT_VALUE

public static final java.lang.String PARAMETER_DEFAULT_VALUE
The parameter name for "The default value all original values are mapped to, if add_default_mapping is set to true."

See Also:
Constant Field Values
Constructor Detail

AttributeValueMapper

public AttributeValueMapper(OperatorDescription description)
Method Detail

apply

public ExampleSet apply(ExampleSet exampleSet)
                 throws OperatorException
Description copied from class: AbstractExampleSetProcessing
Delegate for the apply method. In most cases, the returned example set will be the same as the example set or a modified clone.

Specified by:
apply in class AbstractExampleSetProcessing
Throws:
OperatorException

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


Copyright © 2001-2009 by Rapid-I