[SOLVED] How I can accumulate values?

AreliBallinaAreliBallina Member Posts: 8 Contributor I
edited November 2018 in Help
Hello all!!

I 'm trying to obtain a cumulative values for then select only the values ​​that generate 80%.

I'm expecting the column "NewValue" (accumulated)

Numb    %TA        NewValue
1          0.09          0.09
2          0.06          0.15 (0.09+0.06)
3          0.2            0.35 (0.15+0.2)
4          0.4            0.75 (0.35+0.4)
5          0.05          0.8   (0.75+0.05)
6          ....            .....

But instead this, I obtain the same column %TA

Numb   %TA        NewValue
1          0.09          0.09
2          0.06          0.06
3          0.2            0.2
4          0.4            0.4
5          0.05          0.05
6          ....            .....

The operators I'm using are:

1) Generatte attibute
    attribute name: NewValue
    function expressions: 0

2) Set macro
   macro: accumulate
   value: 0

3)Loop examples
  interation macro: example

Inside Loop examples:

4) Extract macro
   macro: value
   macro type: data_value
   attibute name: %
   example index: %{example}

5) Generate Macro
   macroname: new
   functions expressions: %{accumulate}+%{value}

6) Set Data
   example index: %{example}
   attibute name: Newvalue
   value: %{new}


Could you have any idea to how solve this??

Thank you!!!

Areli


Answers

  • mschmitzmschmitz Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,249 RM Data Scientist
    The easiest way is to use the series extension. Then you can simply use the integrate operator which is calculating cummulative sums.

    example process:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="6.2.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="6.2.000" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="generate_data" compatibility="6.2.000" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30">
            <parameter key="number_examples" value="5"/>
            <parameter key="number_of_attributes" value="1"/>
          </operator>
          <operator activated="true" class="series:integrate_series" compatibility="5.3.000" expanded="true" height="76" name="Integrate" width="90" x="246" y="30">
            <parameter key="attribute_name" value="att1"/>
          </operator>
          <connect from_op="Generate Data" from_port="output" to_op="Integrate" to_port="example set input"/>
          <connect from_op="Integrate" 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>

    - Head of Data Science Services at RapidMiner -
    Dortmund, Germany
  • AreliBallinaAreliBallina Member Posts: 8 Contributor I
    Mschmitz,

    Thank you very much!! I downloaded the extension, tried it and it fixed!!  :D:D

    Regards!!

    Areli

Sign In or Register to comment.