Pages: [1]
  Print  
Author Topic: [SOLVED] How I can accumulate values?  (Read 26 times)
AreliBallina
Newbie
*
Posts: 5


« on: December 18, 2014, 06:53:11 PM »

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


« Last Edit: December 18, 2014, 10:42:58 PM by AreliBallina » Logged
mschmitz
Global Moderator
Newbie
*****
Posts: 45


« Reply #1 on: December 18, 2014, 08:11:00 PM »

The easiest way is to use the series extension. Then you can simply use the integrate operator which is calculating cummulative sums.

example process:

Code:
<?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>

Logged
AreliBallina
Newbie
*
Posts: 5


« Reply #2 on: December 18, 2014, 10:39:11 PM »

Mschmitz,

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

Regards!!

Areli

Logged
Pages: [1]
  Print  
 
Jump to: