How to multiply many columns

olgakulesza2olgakulesza2 Member Posts: 15 Contributor I
edited November 2018 in Help


I'm new at rapid miner. I have a problem with multiplying values from columns. 

Let's imagine I have 4 columns: A,B,C,D. I want to multiply each column B,C,D with A. 

I know I can make it by using 'Generate Attributes', but I have about 100 columns co it is a little bit hard to do it. What's more I would like to have new values of that columns, not the new additional columns. 

For example I have: 

      B         C        D                                                                   

3       1           2         1                                                                  

     2           2         1                                                                  

5       3           1         2       

and what I want to have is:       

A        B         C        D   

       3         6         3

4         8         8         4

5        15       5         10

I would be grateful for any advice.




  • Options
    Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,635 Unicorn

    Just use "Generate Attributes" inside a "Loop Attributes" and you only have to configure it once and RapidMiner will do all the rest of the work for you.  And if you want to overwrite your original attributes, just use the same attribute name with a macro inside the Loop Attributes (if you wanted a new name you could just use the macro and add "_new" to the end).


    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
  • Options
    JEdwardJEdward RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 578 Unicorn

    Here's a process example based on Telecontar's solution.


    <?xml version="1.0" encoding="UTF-8"?><process version="8.2.000">
    <operator activated="true" class="process" compatibility="8.2.000" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" breakpoints="after" class="operator_toolbox:create_exampleset" compatibility="1.0.000" expanded="true" height="68" name="Create ExampleSet" width="90" x="45" y="34">
    <list key="function_descriptions">
    <parameter key="A" value="rand()"/>
    <parameter key="B" value="rand()"/>
    <parameter key="C" value="rand()"/>
    <parameter key="D" value="rand()"/>
    <parameter key="E" value="rand()"/>
    <list key="numeric_series_configuration"/>
    <list key="date_series_configuration"/>
    <list key="date_series_configuration (interval)"/>
    <operator activated="true" class="concurrency:loop_attributes" compatibility="8.2.000" expanded="true" height="82" name="Loop Attributes" width="90" x="246" y="34">
    <parameter key="attribute_filter_type" value="single"/>
    <parameter key="attribute" value="A"/>
    <parameter key="invert_selection" value="true"/>
    <parameter key="reuse_results" value="true"/>
    <process expanded="true">
    <operator activated="true" class="generate_attributes" compatibility="8.2.000" expanded="true" height="82" name="Generate Attributes" width="90" x="179" y="34">
    <list key="function_descriptions">
    <parameter key="%{loop_attribute}" value="A * eval(%{loop_attribute})"/>
    <connect from_port="input 1" to_op="Generate Attributes" to_port="example set input"/>
    <connect from_op="Generate Attributes" from_port="example set output" to_port="output 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="source_input 2" spacing="0"/>
    <portSpacing port="sink_output 1" spacing="0"/>
    <portSpacing port="sink_output 2" spacing="0"/>
    <connect from_op="Create ExampleSet" from_port="output" to_op="Loop Attributes" to_port="input 1"/>
    <connect from_op="Loop Attributes" from_port="output 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="0"/>
Sign In or Register to comment.