Transpose by a Column

ShubhaShubha Member Posts: 139 Maven
edited November 2018 in Help
Hi,

Can I transpose an exampleset (data) by a group variable? Because i see no options in the 'ExampleSetTranspose' to give parameters like a do transpose 'by' a variable. This operator tranposes the whole data. Instead, can we specify the variable by which we need the transpose?

For example, in the below code I wanted to transpose the data by the 'Group' variable.

<operator name="Root" class="Process" expanded="yes">
    <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
        <parameter key="target_function" value="random"/>
        <parameter key="number_examples" value="10"/>
        <parameter key="number_of_attributes" value="1"/>
    </operator>
    <operator name="AttributeConstruction" class="AttributeConstruction">
        <list key="function_descriptions">
          <parameter key="Group" value="if(att1&gt;0,1,0)"/>
        </list>
    </operator>
    <operator name="ExampleSetTranspose" class="ExampleSetTranspose">
    </operator>
</operator>


Please let me know if the question is unclear. It is just like 'PROC TRANSPOSE... by var" in SAS. Or if there is any other operator for this purpose?

Many thanks for your help,
Shubha

Answers

  • haddockhaddock Member Posts: 849 Maven
    This question is unclear. Please provide an example.
  • ShubhaShubha Member Posts: 139 Maven
    Suppose my input exampleset is:

    Group X1
    1 40
    1 70
    1 70
    1 58
    1 45
    2 45
    2 63
    2 62
    2 47
    2 59
    3 65
    3 43
    3 46
    3 40
    3 70
    4 40
    4 64
    4 44
    4 50
    4 58

    The resultant exampleset after transposing by the 'group' variable should look like:

    Group att1 att2 att3 att4 att5
    1 40 70 70 58 45
    2 45 63 62 47 59
    3 65 43 46 40 70
    4 40 64 44 50 58


    Thanks in advance,
    Shubha
  • IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
    This actually is not a transpose but a "pivoting" (or "pivotization"? I am not sure). However, the operator for that is called Example2AttributePivoting.

    Cheers,
    Ingo
  • haddockhaddock Member Posts: 849 Maven
    Hola Ingo!

    Not sure what the real point of this endless list of questions from Shubha is, but here is an answer to the last one, just to make the point. Not sure I'll bother much more.
    <operator name="Root" class="Process" expanded="yes">
        <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
            <parameter key="number_examples" value="10"/>
            <parameter key="number_of_attributes" value="1"/>
            <parameter key="target_function" value="random"/>
        </operator>
        <operator name="AttributeConstruction" class="AttributeConstruction">
            <list key="function_descriptions">
              <parameter key="Group" value="if(att1&gt;0,&quot;A&quot;,&quot;B&quot;)"/>
            </list>
            <parameter key="use_standard_constants" value="false"/>
        </operator>
        <operator name="ValueSubgroupIterator" class="ValueSubgroupIterator" expanded="yes">
            <list key="attributes">
              <parameter key="Group" value="all"/>
            </list>
            <parameter key="filter_attribute" value="false"/>
            <operator name="ExampleSetTranspose" class="ExampleSetTranspose">
            </operator>
        </operator>
    </operator>
  • ShubhaShubha Member Posts: 139 Maven
    Hi,

    If I can dig this thread again, may I know where is the operator "Example2AttributePivoting"?

    Thanks,
    Shubha
  • haddockhaddock Member Posts: 849 Maven
    OLAP

  • ShubhaShubha Member Posts: 139 Maven
    Thanks
Sign In or Register to comment.