The Altair Community is migrating to a new platform to provide a better experience for you. The RapidMiner Community will merge with the Altair Community at the same time. In preparation for the migration, both communities are on read-only mode from July 15th - July 24th, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here.
Options

[SOLVED] How to extract operator parameter into macro

tennenrishintennenrishin Member Posts: 177 Contributor II
edited October 2019 in Help
Is there any way to get a given parameter of a given operator into a macro? For example, if my process has a Retrieve operator, I would like to get Retrieve.repository_entry into a macro.

(You may wonder why I don't rather put the macro into the parameter, but that way the meta data doesn't come out of Retrieve at design-time. Plus I don't get the repository browsing dialog box when setting the macro.)
Tagged:

Answers

  • Options
    awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn
    Hello

    You can use the Log operator to determine and log the value of another operator's parameter. From there convert the single log entry to an example set containing 1 example using the Log to Data operator. Then use the Extract Macro operator to get the value of the lone example into a macro.

    Here's an example (which also re-reports the macro to prove it is being set correctly)
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.008">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.2.008" expanded="true" name="Process">
        <process expanded="true" height="251" width="882">
          <operator activated="true" class="retrieve" compatibility="5.2.008" expanded="true" height="60" name="Retrieve" width="90" x="112" y="120">
            <parameter key="repository_entry" value="//Samples/data/Iris"/>
          </operator>
          <operator activated="true" class="log" compatibility="5.2.008" expanded="true" height="76" name="Log" width="90" x="246" y="120">
            <list key="log">
              <parameter key="repositoryEntry" value="operator.Retrieve.parameter.repository_entry"/>
            </list>
          </operator>
          <operator activated="true" class="log_to_data" compatibility="5.2.008" expanded="true" height="94" name="Log to Data" width="90" x="380" y="120"/>
          <operator activated="true" class="extract_macro" compatibility="5.2.008" expanded="true" height="60" name="Extract Macro" width="90" x="514" y="120">
            <parameter key="macro" value="reMacro"/>
            <parameter key="macro_type" value="data_value"/>
            <parameter key="attribute_name" value="repositoryEntry"/>
            <parameter key="example_index" value="1"/>
          </operator>
          <operator activated="true" class="provide_macro_as_log_value" compatibility="5.2.008" expanded="true" height="76" name="Provide Macro as Log Value" width="90" x="648" y="120">
            <parameter key="macro_name" value="reMacro"/>
          </operator>
          <operator activated="true" class="log" compatibility="5.2.008" expanded="true" height="76" name="Log (2)" width="90" x="782" y="120">
            <list key="log">
              <parameter key="reMacro" value="operator.Provide Macro as Log Value.value.macro_value"/>
            </list>
          </operator>
          <connect from_op="Retrieve" from_port="output" to_op="Log" to_port="through 1"/>
          <connect from_op="Log" from_port="through 1" to_op="Log to Data" to_port="through 1"/>
          <connect from_op="Log to Data" from_port="exampleSet" to_op="Extract Macro" to_port="example set"/>
          <connect from_op="Extract Macro" from_port="example set" to_op="Provide Macro as Log Value" to_port="through 1"/>
          <connect from_op="Provide Macro as Log Value" from_port="through 1" to_op="Log (2)" to_port="through 1"/>
          <connect from_op="Log (2)" from_port="through 1" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
        </process>
      </operator>
    </process>
    regards

    Andrew
  • Options
    tennenrishintennenrishin Member Posts: 177 Contributor II
    Thanks Andrew!
Sign In or Register to comment.