Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.

"rename attributes in loop"

gritsaygritsay Member, University Professor Posts: 12 University Professor
edited June 2019 in Help
Hi! I do process with loop attribute. In the param %{loop_attribute} stored name of attribute on each iteration. How i can rename this attribute on each iteration? rename operator not working with macro.

Alex.

Answers

  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    it does ???
    Have a look at the following process:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="6.0.009">
     <context>
       <input/>
       <output/>
       <macros/>
     </context>
     <operator activated="true" class="process" compatibility="6.0.009" expanded="true" name="Process">
       <process expanded="true">
         <operator activated="true" class="retrieve" compatibility="6.0.009" expanded="true" height="60" name="Retrieve Iris" width="90" x="45" y="30">
           <parameter key="repository_entry" value="//Samples/data/Iris"/>
         </operator>
         <operator activated="true" class="loop_attributes" compatibility="6.0.009" expanded="true" height="76" name="Loop Attributes" width="90" x="179" y="30">
           <process expanded="true">
             <operator activated="true" class="generate_macro" compatibility="6.0.009" expanded="true" height="76" name="Generate Macro" width="90" x="45" y="30">
               <list key="function_descriptions">
                 <parameter key="name" value="concat(&quot;%{loop_attribute}&quot;, &quot;_0&quot;)"/>
               </list>
             </operator>
             <operator activated="true" class="rename" compatibility="6.0.009" expanded="true" height="76" name="Rename" width="90" x="246" y="30">
               <parameter key="old_name" value="%{loop_attribute}"/>
               <parameter key="new_name" value="%{name}"/>
               <list key="rename_additional_attributes"/>
             </operator>
             <connect from_port="example set" to_op="Generate Macro" to_port="through 1"/>
             <connect from_op="Generate Macro" from_port="through 1" to_op="Rename" to_port="example set input"/>
             <connect from_op="Rename" from_port="example set output" to_port="example set"/>
             <portSpacing port="source_example set" spacing="0"/>
             <portSpacing port="sink_example set" spacing="0"/>
             <portSpacing port="sink_result 1" spacing="0"/>
           </process>
         </operator>
         <connect from_op="Retrieve Iris" from_port="output" to_op="Loop Attributes" to_port="example set"/>
         <connect from_op="Loop Attributes" from_port="example set" 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,
    Marco
  • gritsaygritsay Member, University Professor Posts: 12 University Professor
    Thnaks, it really good working.
Sign In or Register to comment.