How to look ahead or back at the records relative to your current record
mazda
New Altair Community Member
I like to set values for my newly created attribute based on a previous value of another attribute (previous record of another attribute). To do this I need to look back or point to another record relative to where I am. Any idea how I could do this in RapidMiner?
Greatly appreciate any ideas you have.
Thanks,
Mazda
Greatly appreciate any ideas you have.
Thanks,
Mazda
Tagged:
0
Answers
-
Maybe the Windowing operator of the Value Series extension could be useful for you.
Otherwise you could try a combination of Loop Examples and Generate Macro as in the process below.<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.2.001">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.2.001" expanded="true" name="Process">
<process expanded="true" height="541" width="969">
<operator activated="true" class="generate_data" compatibility="5.2.001" expanded="true" height="60" name="Generate Data" width="90" x="112" y="30"/>
<operator activated="true" class="loop_examples" compatibility="5.2.001" expanded="true" height="76" name="Loop Examples" width="90" x="313" y="30">
<process expanded="true" height="541" width="969">
<operator activated="true" class="generate_macro" compatibility="5.2.001" expanded="true" height="76" name="Generate Macro" width="90" x="45" y="30">
<list key="function_descriptions">
<parameter key="ex_minus_1" value="%{example}-1"/>
</list>
</operator>
<operator activated="true" class="handle_exception" compatibility="5.2.001" expanded="true" height="76" name="Handle Exception" width="90" x="313" y="30">
<process expanded="true" height="541" width="459">
<operator activated="true" class="extract_macro" compatibility="5.2.001" expanded="true" height="60" name="Extract Macro" width="90" x="112" y="30">
<parameter key="macro" value="value"/>
<parameter key="macro_type" value="data_value"/>
<parameter key="attribute_name" value="att1"/>
<parameter key="example_index" value="%{ex_minus_1}"/>
</operator>
<operator activated="true" class="print_to_console" compatibility="5.2.001" expanded="true" height="76" name="Print to Console" width="90" x="313" y="30">
<parameter key="log_value" value="%{value}"/>
</operator>
<connect from_port="in 1" to_op="Extract Macro" to_port="example set"/>
<connect from_op="Extract Macro" from_port="example set" to_op="Print to Console" to_port="through 1"/>
<connect from_op="Print to Console" from_port="through 1" to_port="out 1"/>
<portSpacing port="source_in 1" spacing="0"/>
<portSpacing port="source_in 2" spacing="0"/>
<portSpacing port="sink_out 1" spacing="0"/>
<portSpacing port="sink_out 2" spacing="0"/>
</process>
<process expanded="true" height="541" width="459">
<connect from_port="in 1" to_port="out 1"/>
<portSpacing port="source_in 1" spacing="0"/>
<portSpacing port="source_in 2" spacing="0"/>
<portSpacing port="sink_out 1" spacing="0"/>
<portSpacing port="sink_out 2" spacing="0"/>
</process>
</operator>
<connect from_port="example set" to_op="Generate Macro" to_port="through 1"/>
<connect from_op="Generate Macro" from_port="through 1" to_op="Handle Exception" to_port="in 1"/>
<connect from_op="Handle Exception" from_port="out 1" to_port="example set"/>
<portSpacing port="source_example set" spacing="0"/>
<portSpacing port="sink_example set" spacing="0"/>
<portSpacing port="sink_output 1" spacing="0"/>
</process>
</operator>
<connect from_op="Generate Data" from_port="output" to_op="Loop Examples" to_port="example set"/>
<connect from_op="Loop Examples" from_port="example set" 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>0 -
Thank you Marius, I'll try your suggestion and repost.
Mazda0