Categories

Versions

Provide Macro as Log Value (AI Studio Core)

Synopsis

This operator reads the value of the specified macro and provides the macro value for logging. This operator is only useful if the required macro value cannot be logged directly.

Description

The Provide Macro as Log Value operator can be used to log the current value of the specified macro. The name of the required macro is specified in the macro name parameter. Most operators provide the macro they define as a loggable value and in these cases this value can be logged directly. But in all other cases where the operator does not provide a loggable value for the defined macro, this operator may be used to do so. Please note that the value will be logged as a nominal value even if it is actually a numerical value.

You must be familiar with the basic concepts of macros and logging in order to understand this operator completely. Some basics of macros and logging are discussed in the coming paragraphs.

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. Once the macro has been defined, the value of that macro can be used as a 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. Please note that many operators like many of the loop operators (e.g. Loop Values , Loop Attributes) also add specific macros. For more information regarding macros please study the Set Macro operator.

Logging and log-related operators store information into the log table. This information can be almost anything including parameter values of operators, apply-count of operators, execution time etc. The Log is mostly used when you want to see the values calculated during the execution of the process that are otherwise not visible. For example you want to see values of different parameters in all iterations of any Loop operator. For more information regarding logging please study the Log operator.

Input

  • through (Data table)

    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 through input port becomes available which is ready to accept another input (if any). The order of inputs remains the same. The object supplied at the first through input port of the Provide Macro as Log Value operator is available at the first through output port.

Output

  • through (Data table)

    The object that was given as input is passed without changing to the output through this port. It is not compulsory to attach this port to any other port. The Provide Macro as Log Value operator can have multiple outputs. When one output is connected, another through output port becomes available which is ready to deliver another output (if any). The order of outputs remains the same. The object delivered at the first through input port of the Provide Macro as Log Value operator is delivered at the first through output port

Parameters

  • macro_nameThis parameter specifies the name of the macro whose value should be provided for logging. Range: string

Tutorial Processes

Logging the value of a macro with or without the Provide Macro as Log Value operator

This Example Process shows how macro values can be logged with or without the Provide Macro as Log Value operator. The 'Golf' data set is loaded using the Retrieve operator. A breakpoint is inserted here so that you can have a look at the ExampleSet. As you can see, there are 14 examples in the ExampleSet. The Extract Macro operator is applied on the ExampleSet. The macro of the extract macro operator is named 'eCount' and it stores the number of examples in the ExampleSet i.e. 14. The Provide Macro as Log Value operator is applied to provide the value of the 'eCount' macro as a loggable value. Finally the Log operator is applied to store the value of the 'eCount' macro in the log table. Have a look at the log parameter settings in the Log operator. Two columns have been defined: 'Direct' and 'Indirect'. The 'Direct' column gets the value of the 'eCount' macro directly from the Extract Macro operator. This only works if the macro is provided in loggable form by the operator. The 'Indirect' column gets the value of the 'eCount' macro from the Provide Macro as Log Value operator. This is how a macro value should be logged if it cannot be logged directly. Run the process and you will see two columns in the Table View of the results of the Log operator. Both columns have the value of the 'eCount' macro (14).