Options

[SOLVED] Using a building block for macro generation or how to get own block

frasfras Member Posts: 93 Contributor II
edited November 2018 in Help
I changed the building block "Transform to Nominal" to something different because
I dont know how to establish my own one. Inside this building block ("GetReach") I
define some macros but these macros are not visible to the main process ("%{last}").
Whats going from ? -Frank

<?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="GetReach">
   <process expanded="true" height="566" width="815">
     <operator activated="true" class="retrieve" compatibility="5.2.008" expanded="true" height="60" name="Testset" width="90" x="45" y="75">
       <parameter key="repository_entry" value="//Samples/data/Golf-Testset"/>
     </operator>
     <operator activated="true" class="sort" compatibility="5.2.008" expanded="true" height="76" name="Sort (2)" width="90" x="179" y="75">
       <parameter key="attribute_name" value="Temperature"/>
       <parameter key="sorting_direction" value="decreasing"/>
     </operator>
     <operator activated="true" class="filter_example_range" compatibility="5.2.008" expanded="true" height="76" name="filtered (2)" width="90" x="313" y="75">
       <parameter key="first_example" value="1"/>
       <parameter key="last_example" value="%{last}"/>
     </operator>
     <operator activated="true" class="subprocess" compatibility="5.2.008" expanded="true" height="76" name="Transform to Nominal" width="90" x="45" y="210">
       <description>Replaces missing values and discretizes numerical attributes.</description>
       <process expanded="true" height="614" width="940">
         <operator activated="true" class="retrieve" compatibility="5.2.008" expanded="true" height="60" name="Retrieve" width="90" x="45" y="30">
           <parameter key="repository_entry" value="//Samples/data/Golf"/>
         </operator>
         <operator activated="true" class="extract_macro" compatibility="5.2.008" expanded="true" height="60" name="Extract Macro" width="90" x="180" y="30">
           <parameter key="macro" value="size"/>
         </operator>
         <operator activated="true" class="extract_macro" compatibility="5.2.008" expanded="true" height="60" name="Extract Macro (2)" width="90" x="221" y="120">
           <parameter key="macro" value="reach"/>
           <parameter key="macro_type" value="statistics"/>
           <parameter key="statistics" value="count"/>
           <parameter key="attribute_name" value="Play"/>
           <parameter key="attribute_value" value="yes"/>
         </operator>
         <operator activated="true" class="generate_macro" compatibility="5.2.008" expanded="true" height="76" name="Generate Macro" width="90" x="262" y="210">
           <list key="function_descriptions">
             <parameter key="last" value="round(%{size} * %{reach}/%{size}, 0)"/>
           </list>
         </operator>
         <connect from_op="Retrieve" from_port="output" to_op="Extract Macro" to_port="example set"/>
         <connect from_op="Extract Macro" from_port="example set" to_op="Extract Macro (2)" to_port="example set"/>
         <connect from_op="Extract Macro (2)" from_port="example set" to_op="Generate Macro" to_port="through 1"/>
         <connect from_op="Generate Macro" from_port="through 1" to_port="out 1"/>
         <portSpacing port="source_in 1" spacing="0"/>
         <portSpacing port="sink_out 1" spacing="0"/>
         <portSpacing port="sink_out 2" spacing="0"/>
       </process>
     </operator>
     <connect from_op="Testset" from_port="output" to_op="Sort (2)" to_port="example set input"/>
     <connect from_op="Sort (2)" from_port="example set output" to_op="filtered (2)" to_port="example set input"/>
     <connect from_op="filtered (2)" from_port="example set output" to_port="result 2"/>
     <connect from_op="Transform to Nominal" from_port="out 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="18"/>
     <portSpacing port="sink_result 3" spacing="0"/>
   </process>
 </operator>
</process>

Answers

  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi Frank,

    the Transform to.. operator is executed after the other tree operators. Please click the button with the blue arrows and the question mark on top of the process pane to fix the execution order. To bring an operator to front in the execution chain, right click on it and then select "bring to front".

    To create custom building blocks, select the operators that you want to save as building block. Then go to Edit->Save as Building Block.

    Best,
    Marius
  • Options
    frasfras Member Posts: 93 Contributor II
    Ah, execution order...I never saw it before. Thx.
Sign In or Register to comment.