The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Consistent loop behaviour when iterating zero times

tennenrishintennenrishin Member Posts: 177 Contributor II
edited June 2019 in Help
The following process generates an error when it runs, simply because the number of loop iterations happens to be zero. But if any other number of attributes matched, there would not have been an error.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.2.006">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.2.006" expanded="true" name="Process">
    <process expanded="true" height="486" width="907">
      <operator activated="true" class="generate_data" compatibility="5.2.006" expanded="true" height="60" name="Generate Data" width="90" x="112" y="75"/>
      <operator activated="true" class="loop_attributes" compatibility="5.2.006" expanded="true" height="60" name="Loop Attributes" width="90" x="313" y="75">
        <parameter key="attribute_filter_type" value="regular_expression"/>
        <parameter key="regular_expression" value="regexThatMayMatchZeroAttributes"/>
        <process expanded="true" height="486" width="907">
          <connect from_port="example set" to_port="example set"/>
          <portSpacing port="source_example set" spacing="0"/>
          <portSpacing port="sink_example set" spacing="0"/>
        </process>
      </operator>
      <connect from_op="Generate Data" from_port="output" to_op="Loop Attributes" to_port="example set"/>
      <connect from_op="Loop Attributes" 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>
Certain loop operators (e.g. Loop Attributes) can be considered a repetitive chain of their contents. Extrapolating this principle down to zero iterations, the consistent behavior would be that the loop operator has no effect (rather than generating an error).

Answers

  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi, thank's for the hint, indeed some of the loop operators need some love.
Sign In or Register to comment.