🎉 🎉 RAPIDMINER 9.10 IS OUT!!! 🎉🎉

Download the latest version helping analytics teams accelerate time-to-value for streaming and IIOT use cases.

CLICK HERE TO DOWNLOAD

"Loop Subset Attributes: Feature Names"

MuehliManMuehliMan Member Posts: 85  Guru
edited June 2019 in Help
Dear all,

I am working with the Loop Subset Operator to iteratively select exactly  2 attributes from my dataset and generate various new attributes based on these two, like atts1/atts2 or atts1*log(atts2). The thing is I would therefore need to address both attributes from a variable name.

If I only have one I can use Loop Attributes and set a variable name for that. But I would like to do this for two attributes. Is that possible?

Best regards,
Markus

Answers

  • haddockhaddock Member Posts: 849  Maven
    Greets Markus,

    You could nest loops, but that would create duplicate pairs, so you'd need to loop through the inner subset, like this ...
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.0">
     <context>
       <input/>
       <output/>
       <macros/>
     </context>
     <operator activated="true" class="process" compatibility="5.0.0" expanded="true" name="">
       <process expanded="true" height="365" width="547">
         <operator activated="true" class="generate_data" compatibility="5.0.8" expanded="true" height="60" name="Generate Data" width="90" x="180" y="30"/>
         <operator activated="true" class="loop_attributes" compatibility="5.0.8" expanded="true" height="60" name="Loop Attributes" width="90" x="447" y="75">
           <parameter key="iteration_macro" value="loop_attribute1"/>
           <process expanded="true" height="383" width="413">
             <operator activated="true" class="work_on_subset" compatibility="5.0.8" expanded="true" height="76" name="Work on Subset" width="90" x="112" y="30">
               <parameter key="attribute_filter_type" value="regular_expression"/>
               <parameter key="regular_expression" value="%{loop_attribute1}"/>
               <parameter key="invert_selection" value="true"/>
               <process expanded="true" height="383" width="926">
                 <operator activated="true" class="loop_attributes" compatibility="5.0.8" expanded="true" height="60" name="Loop Attributes (2)" width="90" x="246" y="28">
                   <parameter key="iteration_macro" value="loop_attribute2"/>
                   <process expanded="true" height="383" width="926">
                     <operator activated="true" class="set_macro" compatibility="5.0.8" expanded="true" height="76" name="Set Macro" width="90" x="161" y="20">
                       <parameter key="macro" value="combined"/>
                       <parameter key="value" value="%{loop_attribute1}/%{loop_attribute2}"/>
                     </operator>
                     <operator activated="true" class="provide_macro_as_log_value" compatibility="5.0.8" expanded="true" height="76" name="Provide Macro as Log Value" width="90" x="355" y="19">
                       <parameter key="macro_name" value="combined"/>
                     </operator>
                     <operator activated="true" class="log" compatibility="5.0.8" expanded="true" height="76" name="Log" width="90" x="537" y="17">
                       <list key="log">
                         <parameter key="atts" value="operator.Provide Macro as Log Value.value.macro_value"/>
                       </list>
                     </operator>
                     <connect from_port="example set" to_op="Set Macro" to_port="through 1"/>
                     <connect from_op="Set Macro" from_port="through 1" 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" to_port="through 1"/>
                     <connect from_op="Log" from_port="through 1" to_port="example set"/>
                     <portSpacing port="source_example set" spacing="0"/>
                     <portSpacing port="sink_example set" spacing="0"/>
                   </process>
                 </operator>
                 <connect from_port="exampleSet" to_op="Loop Attributes (2)" to_port="example set"/>
                 <connect from_op="Loop Attributes (2)" from_port="example set" to_port="example set"/>
                 <portSpacing port="source_exampleSet" spacing="0"/>
                 <portSpacing port="sink_example set" spacing="0"/>
                 <portSpacing port="sink_through 1" spacing="0"/>
               </process>
             </operator>
             <connect from_port="example set" to_op="Work on Subset" to_port="example set"/>
             <connect from_op="Work on Subset" from_port="example set" to_port="example set"/>
             <portSpacing port="source_example set" spacing="0"/>
             <portSpacing port="sink_example set" spacing="0"/>
           </process>
         </operator>
         <connect from_op="Generate Data" 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>
    Or we can be a bit more fancy like this... 8)

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.0">
     <context>
       <input/>
       <output/>
       <macros/>
     </context>
     <operator activated="true" class="process" compatibility="5.0.8" expanded="true" name="Process">
       <process expanded="true" height="383" width="908">
         <operator activated="true" class="generate_data" compatibility="5.0.8" expanded="true" height="60" name="Generate Data" width="90" x="77" y="86"/>
         <operator activated="true" class="generate_function_set" compatibility="5.0.8" expanded="true" height="76" name="Generate Function Set" width="90" x="332" y="83">
           <parameter key="use_diff" value="true"/>
         </operator>
         <operator activated="true" class="rename_by_constructions" compatibility="5.0.8" expanded="true" height="76" name="Rename by Constructions" width="90" x="486" y="81"/>
         <connect from_op="Generate Data" from_port="output" to_op="Generate Function Set" to_port="example set input"/>
         <connect from_op="Generate Function Set" from_port="example set output" to_op="Rename by Constructions" to_port="example set input"/>
         <connect from_op="Rename by Constructions" from_port="example set output" 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>
    I used this method to find functions in a myExperiment offering of that name. http://www.myexperiment.org/workflows/1321.html

    Have fun  ;D


Sign In or Register to comment.