Skip to main content

Generate Macro

Synopsis

这个操作符可以用来计算新宏from existing macros. A macro can be used by writing

%{macro_name}in parameter values of succeeding operators of the current process. A Macro can be considered as a value that can be used by all operators of the current process that come after the macro has been defined. This operator can also be used to re-define existing macros.

Description

This operator can be used to define macros which can be used in parameter values of succeeding operators of the current process. Once the macro has been defined, the value of that macro can be used as parameter value in coming operators by writing the macro name in%{macro_name}format in the parameter value where 'macro_name' is the name of the macro specified when it was defined. In Generate Macro operator macro names and function descriptions are specified in thefunction descriptionsparameters. The macro will be replaced in the value strings of parameters by the macro's value. This operator can also be used to re-define existing macros by specifying the name of that macro as name in thefunction descriptionsparameter.

A large number of operations and functions is supported, which allows you to write rich expressions. For a list of operations and functions and their descriptions open the Edit Expression dialog. Complicated expressions can be created by using multiple operations and functions. Parenthesis can be used to nest operations. Since RapidMiner 6.0.3 the operator will fail if an expression is not valid so that you can correct it. The description of all operations follows this format:

This operator also supports various constants (for example 'INFINITY', 'PI' and 'e'). Again you can find a complete list in the Edit Expression dialog. You can also use strings in operations but the string values should be enclosed in double quotes (").

The functions available in the Generate Macro operator behave analogously to the functions of theGenerate Attributesoperator. Please study theExample Processof the Generate Attributes operator to understand the use of these functions.

Macros

Macro can be considered as a value that can be used by all operators of the current process that come after the macro has been defined. Whenever using macros, make sure that the operators are in the correct sequence. It is compulsory that the macro should be defined before it can be used in parameter values. Macro is one of the advanced topics of RapidMiner, please study the attached Example Processes to develop a better understanding of macros.

There are also some predefined macros:

  • %{process_name}: will be replaced by the name of the process (without path and extension)
  • %{process_file}: will be replaced by the file name of the process (with extension)
  • %{process_path}: will be replaced by the complete absolute path of the process file
  • %{execution_count}: will be replaced by the number of times the current operator was applied.
  • %{operator_name}: will be replaced by the name of the current operator.

Please note that other operators like many of the loop operators (e.g. Loop Values , Loop Attributes) also add specific macros.

Input

通过

It is not compulsory to connect any object with this port. Any object connected at this port is delivered without any modifications to the output port. This operator can have multiple inputs. When one input is connected, another通过input port becomes available which is ready to accept another input (if any). The order of inputs remains the same. The object supplied at first通过input port of the Generate Macro operator is available at the first通过output port.

Output

通过

The objects that were given as input are passed without changing to the output through this port. It is not compulsory to attach this port to any other port, the macro value is calculated even if this port is left without connections. The Generate Macro operator can have multiple outputs. When one output is connected, another通过输出端口可用which is ready to deliver another output (if any). The order of outputs remains the same. The object delivered at the first通过input port of the Generate Macro operator is delivered at the first通过output port

Parameters

Function descriptions

The list of macro names together with the expressions which define the new macros are specified through this parameter.