The Altair Community is migrating to a new platform to provide a better experience for you. The RapidMiner Community will merge with the Altair Community at the same time. In preparation for the migration, both communities are on read-only mode from July 15th - July 24th, 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.

Modulo operator in RM?

wesselwessel Member Posts: 537 Maven
edited November 2018 in Help

Is there a Modulo operator in RM5?
Like java: a % b = c


  • Options
    colocolo Member Posts: 236 Maven
    Hi wessel,

    this should work everywhere where expressions are allowed/evaluated. The syntax is equal to Java, as you posted it. Just tried it with a simple example.
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.0">
     <operator activated="true" class="process" compatibility="5.0.8" expanded="true" name="Process">
       <process expanded="true" height="613" width="741">
         <operator activated="true" class="generate_data" compatibility="5.0.8" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30">
           <parameter key="number_examples" value="5"/>
           <parameter key="number_of_attributes" value="1"/>
           <parameter key="attributes_lower_bound" value="0.0"/>
         <operator activated="true" class="generate_attributes" compatibility="5.0.8" expanded="true" height="76" name="Generate Attributes" width="90" x="246" y="30">
           <list key="function_descriptions">
             <parameter key="mod3" value="floor(att1) % 3"/>
         <connect from_op="Generate Data" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
         <connect from_op="Generate Attributes" from_port="example set output" 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"/>
  • Options
    wesselwessel Member Posts: 537 Maven
    Ah cool!

    Its even defined on non integers!

    So you don't need to floor stuff.

Sign In or Register to comment.