Filter/compare value of current row with the next row.

zulfezulfe Member Posts: 2 Contributor I
edited February 2020 in Help
Hi,

I have a need to create a filter similar to the one in IBM SPSS. In IBM SPSS there is a function @offset. It compares the current value with the value in the next row or previous row.

More details about @offset are at the following link.
http://tech.oscarvalles.com/2010/11/using-offset-in-spss-clementine/

Is it possible to create a similar function in RapidMiner.

Basically what I want to do is:

If (value of column x of current row = to value of column x or y of a differnt row)
then (calculation etc).

Thanks
Tagged:

Answers

  • d_hofmann84d_hofmann84 Member Posts: 7 Contributor II
    I'm looking for the same function. Is there realy no simular way to reference to the previous or next row? A work arround could be the Lag Operator (Time Series Plugin) - but this operator can't do negative shifts.
  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi,

    the Lag operator is indeed what I would suggest. Btw, if you compare the columns the other way round you have the negative shifts, or did I get something wrong?

    Furthermore maybe the Differentiate operator may be of interest.

    If you combine any of them with Generate Attributes you are quite flexible.

    Best regards,
    Marius
  • d_hofmann84d_hofmann84 Member Posts: 7 Contributor II
    Hi,

    I don't realy understand how you mean to compare the other way around: Let us say you have the following Data:

    Date                  Date-1 (lag1)
    Timestamp1      -
    Timestamp2      Timestamp1
    Timestamp3      Timestamp2
    Timestamp4      Timestamp3
                            Timestamp4

    With the lag opererator I can only compare Timestamp 1&2 at line 2 and not Timestamp 1&2 at line 1. Therefore I can compare with the past value but not with the next, (especially if one likes to use the "Generate Attribute" Operator in order to generate a new value based on the calculations). I solve this problem right now with LOOP, Extract Macro and Set Data Operator. Any other tipps? The Differentiate operator seems also only allow positive shifts.
  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    That's right, you cannot compare with a future value in the first row, but you can in the second row. Of course that does not work if you have other columns in the data that are not lagged, but if you only consider the Date column it should work. Of course I admit that a negative lag would be handy here.

    Best regards,
    Marius
Sign In or Register to comment.