πŸ₯³ RAPIDMINER 9.9 IS OUT!!! πŸ₯³

The updates in 9.9 power advanced use cases and offer productivity enhancements for users who prefer to code.

CLICK HERE TO DOWNLOAD

How to use Nested loop

Himanshu_PantHimanshu_Pant Member Posts: 30 Contributor I
edited June 8 in Help
I have a dataset which contains dates. Firstly I want to iterate date by date. So I have used loop example. Then for each date I want to iterate some number of time (e,g, 3 times or (%{b}-%{a}+1) times. With each iteration of second loop I want to do certain task (e.g. creating last 24 hour data in 15 minute gap) and finally combine the total result in main process.

Best Answer

  • MarcoBarradasMarcoBarradas Administrator, Employee, RapidMiner Certified Analyst, Member Posts: 183   Unicorn
    Solution Accepted
    @Himanshu_Pant

    Please see the process I'm pasting it could give you and idea on how to configure what you are trying to setup

    If this helps I could try to help you figure out the other steps.
    <?xml version="1.0" encoding="UTF-8"?><process version="9.9.002">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="9.9.002" expanded="true" name="Process">
        <parameter key="logverbosity" value="init"/>
        <parameter key="random_seed" value="-1"/>
        <parameter key="send_mail" value="never"/>
        <parameter key="notification_email" value=""/>
        <parameter key="process_duration_for_mail" value="30"/>
        <parameter key="encoding" value="SYSTEM"/>
        <process expanded="true">
          <operator activated="true" class="utility:create_exampleset" compatibility="9.9.002" expanded="true" height="68" name="Dates" width="90" x="45" y="85">
            <parameter key="generator_type" value="date series"/>
            <parameter key="number_of_examples" value="3"/>
            <parameter key="use_stepsize" value="false"/>
            <list key="function_descriptions"/>
            <parameter key="add_id_attribute" value="false"/>
            <list key="numeric_series_configuration"/>
            <list key="date_series_configuration">
              <parameter key="Date" value="2021-06-01 00:00:00.2021-06-07 00:00:00"/>
            </list>
            <list key="date_series_configuration (interval)"/>
            <parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/>
            <parameter key="time_zone" value="SYSTEM"/>
            <parameter key="column_separator" value=","/>
            <parameter key="parse_all_as_nominal" value="false"/>
            <parameter key="decimal_point_character" value="."/>
            <parameter key="trim_attribute_names" value="true"/>
          </operator>
          <operator activated="true" class="generate_data" compatibility="9.9.002" expanded="true" height="68" name="Generate Data" width="90" x="45" y="187">
            <parameter key="target_function" value="random"/>
            <parameter key="number_examples" value="3"/>
            <parameter key="number_of_attributes" value="1"/>
            <parameter key="attributes_lower_bound" value="2.0"/>
            <parameter key="attributes_upper_bound" value="5.0"/>
            <parameter key="gaussian_standard_deviation" value="10.0"/>
            <parameter key="largest_radius" value="10.0"/>
            <parameter key="use_local_random_seed" value="false"/>
            <parameter key="local_random_seed" value="1992"/>
            <parameter key="datamanagement" value="double_array"/>
            <parameter key="data_management" value="auto"/>
          </operator>
          <operator activated="true" class="operator_toolbox:merge" compatibility="2.10.000" expanded="true" height="103" name="Merge Attributes" width="90" x="246" y="136">
            <parameter key="handling_of_duplicate_attributes" value="rename"/>
            <parameter key="handling_of_special_attributes" value="keep_first_special_other_regular"/>
            <parameter key="handling_of_duplicate_annotations" value="rename"/>
          </operator>
          <operator activated="true" class="generate_copy" compatibility="9.9.002" expanded="true" height="82" name="Generate Copy" width="90" x="45" y="340">
            <parameter key="attribute_name" value="Date"/>
            <parameter key="new_name" value="Date_Nominal"/>
          </operator>
          <operator activated="true" class="generate_copy" compatibility="9.9.002" expanded="true" height="82" name="Generate Copy (2)" width="90" x="179" y="340">
            <parameter key="attribute_name" value="Date"/>
            <parameter key="new_name" value="Date_minus_24hrs"/>
          </operator>
          <operator activated="true" class="adjust_date" compatibility="9.9.002" expanded="true" height="82" name="Adjust Date" width="90" x="313" y="340">
            <parameter key="attribute_name" value="Date_minus_24hrs"/>
            <list key="adjustments">
              <parameter key="-1" value="Day"/>
            </list>
            <parameter key="keep_old_attribute" value="false"/>
          </operator>
          <operator activated="true" class="date_to_nominal" compatibility="9.9.002" expanded="true" height="82" name="Date to Nominal" width="90" x="447" y="340">
            <parameter key="attribute_name" value="Date_Nominal"/>
            <parameter key="date_format" value="yyy-MM-dd hh:mm:ss"/>
            <parameter key="time_zone" value="SYSTEM"/>
            <parameter key="locale" value="English (United States)"/>
            <parameter key="keep_old_attribute" value="false"/>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="9.9.002" expanded="true" height="82" name="Generate Attributes" width="90" x="581" y="340">
            <list key="function_descriptions">
              <parameter key="att1" value="round(att1,0)"/>
            </list>
            <parameter key="keep_all" value="true"/>
          </operator>
          <operator activated="true" class="loop_examples" compatibility="9.9.002" expanded="true" height="103" name="Loop Examples" width="90" x="715" y="340">
            <parameter key="iteration_macro" value="example"/>
            <process expanded="true">
              <operator activated="true" class="date_to_nominal" compatibility="9.9.002" expanded="true" height="82" name="Date to Nominal (2)" width="90" x="45" y="34">
                <parameter key="attribute_name" value="Date_minus_24hrs"/>
                <parameter key="date_format" value="yyyy-MM-dd hh:mm:ss"/>
                <parameter key="time_zone" value="SYSTEM"/>
                <parameter key="locale" value="English (United States)"/>
                <parameter key="keep_old_attribute" value="false"/>
              </operator>
              <operator activated="true" class="extract_macro" compatibility="9.9.002" expanded="true" height="68" name="Extract Macro" width="90" x="179" y="34">
                <parameter key="macro" value="From"/>
                <parameter key="macro_type" value="data_value"/>
                <parameter key="statistics" value="average"/>
                <parameter key="attribute_name" value="Date_minus_24hrs"/>
                <parameter key="example_index" value="%{example}"/>
                <list key="additional_macros">
                  <parameter key="To" value="Date_minus_24hrs"/>
                  <parameter key="Count" value="att1"/>
                </list>
              </operator>
              <operator activated="true" class="concurrency:loop" compatibility="9.9.002" expanded="true" height="82" name="Loop" width="90" x="447" y="34">
                <parameter key="number_of_iterations" value="%{Count}"/>
                <parameter key="iteration_macro" value="iteration"/>
                <parameter key="reuse_results" value="false"/>
                <parameter key="enable_parallel_execution" value="true"/>
                <process expanded="true">
                  <operator activated="true" class="utility:create_exampleset" compatibility="9.9.002" expanded="true" height="68" name="Last 24 hrs with step size" width="90" x="380" y="34">
                    <parameter key="generator_type" value="date series"/>
                    <parameter key="number_of_examples" value="90"/>
                    <parameter key="use_stepsize" value="true"/>
                    <list key="function_descriptions"/>
                    <parameter key="add_id_attribute" value="false"/>
                    <list key="numeric_series_configuration"/>
                    <list key="date_series_configuration">
                      <parameter key="Date" value="%{From}.%{To}"/>
                    </list>
                    <list key="date_series_configuration (interval)">
                      <parameter key="Date" value="%{From}.15.minute"/>
                    </list>
                    <parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/>
                    <parameter key="time_zone" value="SYSTEM"/>
                    <parameter key="column_separator" value=","/>
                    <parameter key="parse_all_as_nominal" value="false"/>
                    <parameter key="decimal_point_character" value="."/>
                    <parameter key="trim_attribute_names" value="true"/>
                  </operator>
                  <connect from_op="Last 24 hrs with step size" from_port="output" to_port="output 1"/>
                  <portSpacing port="source_input 1" spacing="0"/>
                  <portSpacing port="sink_output 1" spacing="0"/>
                  <portSpacing port="sink_output 2" spacing="0"/>
                </process>
              </operator>
              <connect from_port="example set" to_op="Date to Nominal (2)" to_port="example set input"/>
              <connect from_op="Date to Nominal (2)" from_port="example set output" to_op="Extract Macro" to_port="example set"/>
              <connect from_op="Loop" from_port="output 1" to_port="output 1"/>
              <portSpacing port="source_example set" spacing="0"/>
              <portSpacing port="sink_example set" spacing="0"/>
              <portSpacing port="sink_output 1" spacing="0"/>
              <portSpacing port="sink_output 2" spacing="0"/>
            </process>
          </operator>
          <operator activated="true" class="append" compatibility="9.9.002" expanded="true" height="82" name="Append" width="90" x="916" y="187">
            <parameter key="datamanagement" value="double_array"/>
            <parameter key="data_management" value="auto"/>
            <parameter key="merge_type" value="all"/>
          </operator>
          <connect from_op="Dates" from_port="output" to_op="Merge Attributes" to_port="example set 1"/>
          <connect from_op="Generate Data" from_port="output" to_op="Merge Attributes" to_port="example set 2"/>
          <connect from_op="Merge Attributes" from_port="merged set" to_op="Generate Copy" to_port="example set input"/>
          <connect from_op="Generate Copy" from_port="example set output" to_op="Generate Copy (2)" to_port="example set input"/>
          <connect from_op="Generate Copy (2)" from_port="example set output" to_op="Adjust Date" to_port="example set input"/>
          <connect from_op="Adjust Date" from_port="example set output" to_op="Date to Nominal" to_port="example set input"/>
          <connect from_op="Date to Nominal" from_port="example set output" to_op="Generate Attributes" to_port="example set input"/>
          <connect from_op="Generate Attributes" from_port="example set output" to_op="Loop Examples" to_port="example set"/>
          <connect from_op="Loop Examples" from_port="output 1" to_op="Append" to_port="example set 1"/>
          <connect from_op="Append" from_port="merged 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>


    Himanshu_Pant

Answers

Sign In or Register to comment.