RapidMiner

RapidMiner

reference for previous value of an attribute

Contributor II

reference for previous value of an attribute

Hi all,
i have an attribute att1 and i want to build newatt by generate attribute's function expression that is the difference between the actual value of att1 and the value of att1 of the previous example (row). How can i reference the value of att1 of the previous example?
Thanks for the help
4 REPLIES
Super Contributor

Re: reference for previous value of an attribute

Hello

The Differentiate operator in the value series extension might give you something to start with

regards

Andrew
Contributor II

Re: reference for previous value of an attribute

Thanks Andrew,
i have to use in the formula attributes of the same example but from differents time series?
for example i have to calculate a percent variation between more than one attribute of the preview or following rows?
To explain, In excel being in row number 2 to on the column c (C2) i should calcutate something like = (A1-B1)/B1*100
How to implement it in Rapidminer (using pure RM or by Series Extension)?
Is there any user manual of series extensions?
Super Contributor

Re: reference for previous value of an attribute

Hello Robben

I get it - you could try the Lag Series operator. Here's an example

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.008">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.3.008" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="generate_data" compatibility="5.3.008" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30">
        <parameter key="number_of_attributes" value="3"/>
      </operator>
      <operator activated="true" class="generate_attributes" compatibility="5.3.008" expanded="true" height="76" name="Generate Attributes" width="90" x="179" y="30">
        <list key="function_descriptions">
          <parameter key="newAtt" value="(att1-att2)/(att3*100)"/>
        </list>
      </operator>
      <operator activated="true" class="series:lag_series" compatibility="5.3.000" expanded="true" height="76" name="Lag Series" width="90" x="313" y="30">
        <list key="attributes">
          <parameter key="newAtt" value="1"/>
        </list>
      </operator>
      <connect from_op="Generate Data" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
      <connect from_op="Generate Attributes" from_port="example set output" to_op="Lag Series" to_port="example set input"/>
      <connect from_op="Lag Series" from_port="example set output" to_port="result 1"/>
      <connect from_op="Lag Series" from_port="original" to_port="result 2"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
      <portSpacing port="sink_result 3" spacing="0"/>
    </process>
  </operator>
</process>


regards

Andrew
Contributor II

Re: reference for previous value of an attribute

Hi Andrew,
thanks a lot. I will check your solution
Roberto