Options

splite and pile example

franaffranaf Member Posts: 13 Contributor II
edited November 2018 in Help
Hi, I´m trying to do the following:
I have a dataset consisting in only one example in the form

A1,B1,C1,D1,A2,B2,C2,D2,...

I want to iterate through it and cut at specific positions (e.g.: every 4 values) discarding some positions to obtain the following form:

A1,B1,D1
A2,B2,D2
...

Is there a form to do that in Rapidminer?
Thanks for your help

Answers

  • Options
    Nils_WoehlerNils_Woehler Member Posts: 463 Maven
    Hi,

    try this process to transform your data:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.1.011">
     <context>
       <input/>
       <output/>
       <macros/>
     </context>
     <operator activated="true" class="process" compatibility="5.1.011" expanded="true" name="Process">
       <process expanded="true" height="621" width="932">
         <operator activated="true" class="generate_data_user_specification" compatibility="5.1.011" expanded="true" height="60" name="Generate Data by User Specification" width="90" x="45" y="30">
           <list key="attribute_values">
             <parameter key="TestAttribute" value="&quot;a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3,a4,b4,c4,d4&quot;"/>
           </list>
           <list key="set_additional_roles"/>
         </operator>
         <operator activated="true" class="split" compatibility="5.1.011" expanded="true" height="76" name="Split" width="90" x="179" y="30"/>
         <operator activated="true" class="transpose" compatibility="5.1.011" expanded="true" height="76" name="Transpose" width="90" x="313" y="30"/>
         <operator activated="true" class="generate_id" compatibility="5.1.011" expanded="true" height="76" name="Generate ID" width="90" x="447" y="30">
           <parameter key="offset" value="-1"/>
         </operator>
         <operator activated="true" class="generate_attributes" compatibility="5.1.011" expanded="true" height="76" name="Generate Attributes" width="90" x="581" y="30">
           <list key="function_descriptions">
             <parameter key="index" value="mod(id,4)"/>
             <parameter key="id" value="floor(id / 4)"/>
           </list>
         </operator>
         <operator activated="true" class="pivot" compatibility="5.1.011" expanded="true" height="76" name="Pivot" width="90" x="715" y="30">
           <parameter key="group_attribute" value="id"/>
           <parameter key="index_attribute" value="index"/>
         </operator>
         <connect from_op="Generate Data by User Specification" from_port="output" to_op="Split" to_port="example set input"/>
         <connect from_op="Split" from_port="example set output" to_op="Transpose" to_port="example set input"/>
         <connect from_op="Transpose" from_port="example set output" to_op="Generate ID" to_port="example set input"/>
         <connect from_op="Generate ID" from_port="example set output" to_op="Generate Attributes" to_port="example set input"/>
         <connect from_op="Generate Attributes" from_port="example set output" to_op="Pivot" to_port="example set input"/>
         <connect from_op="Pivot" 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>
    Best,
    Nils
  • Options
    franaffranaf Member Posts: 13 Contributor II
    It worked. :D
    Thanks a lot.

Sign In or Register to comment.