Filtering with a looped parameter
Hi All,
I have a data set with dates ranging from the beginning to the end of 2016. I am creating a forecasting model and I want to iterate through the data set multiple times, the first time removing the last 6 months, the second time removing the last 5 months, then removing the last 4 months etc.
我目前想这使用循环对位meters operation and trying to adjust the filter, however I can either not get the syntax right or need a different approach.
Could someone please tell me the exact options to select in the loop parameters tool or a better method
Thank you in advance
Best Answer
-
MartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University ProfessorPosts:3,314RM Data Scientist
Dear Edindsa,
i would propose to do this with a standard Loop operator. It gives you a macro (e.g. process variable) with the current iteration number. We can use this to generate ourselves a macro with the filter value and use it in the filter. The expressions we use for this can be very sophisticated.
An example is attached.
Best,
Martin
<操作符活动vated="true" class="process" compatibility="7.5.003" expanded="true" name="Process">
<操作符活动vated="true" class="generate_data" compatibility="7.5.003" expanded="true" height="68" name="Generate Data" width="90" x="45" y="34"/>
<操作符活动vated="true" class="extract_macro" compatibility="7.5.003" expanded="true" height="68" name="Extract Macro" width="90" x="246" y="34">
<操作符活动vated="true" class="concurrency:loop" compatibility="7.5.003" expanded="true" height="82" name="Loop" width="90" x="514" y="34">
<操作符活动vated="true" class="generate_macro" compatibility="7.5.003" expanded="true" height="82" name="Generate Macro (2)" width="90" x="179" y="34">We can do more complex things here
<操作符活动vated="true" class="filter_examples" compatibility="7.5.003" expanded="true" height="103" name="Filter Examples (2)" width="90" x="447" y="34">
<操作符活动vated="true" class="h2o:generalized_linear_model" compatibility="7.5.000" expanded="true" height="103" name="Generalized Linear Model (2)" width="90" x="648" y="34">
<操作符活动vated="false" class="loop_parameters" compatibility="7.5.003" expanded="true" height="82" name="Loop Parameters" width="90" x="514" y="289">
<操作符活动vated="true" class="generate_macro" compatibility="7.5.003" expanded="true" height="82" name="Generate Macro" width="90" x="45" y="34">
<操作符活动vated="true" class="filter_examples" compatibility="7.5.003" expanded="true" height="103" name="Filter Examples" width="90" x="447" y="34">
<操作符活动vated="true" class="h2o:generalized_linear_model" compatibility="7.5.000" expanded="true" height="103" name="Generalized Linear Model" width="90" x="782" y="34">- Head of Data Science Services at RapidMiner -
Dortmund, Germany0
Answers
I may not fully understand the exact thing you would like to achieve, but I would probably take a look at the Macro operators (Set Macro or Extract Macro) and use the defined macros as loop parameters. If your data is not sensitive, or, if you can make up fake data with the same structure and post it here, I can take a closer look.
Dear Edinsda,
Do you want to do this for validation purposes? In this case Sliding Window Validation might be the right operator.
Otherwise you can do it with a combination of Loop Parameters and Filter Examples Range (or Filter Examples). Attached is a process which shows it.
Best,
Martin
Dortmund, Germany
Thank you both for your response.
Here is an example XML for what I am trying to achive. Where the filter value is set to 1, I want to loop through setting it to 1, 2, 3, 4, 5, 6, 7, 8 and 9.
The biggest issue is that I don't know what to select in loop parameters, see the image below.
I can't get the parameter string or parameter expression to work and I don't know what the others do.
Thanks again