Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.

Modulo operator in RM?

wesselwessel Member Posts: 537 Maven
edited November 2018 in Help
Hey,

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

http://en.wikipedia.org/wiki/Modulo_operator

Answers

  • 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">
     <context>
       <input/>
       <output/>
       <macros/>
     </context>
     <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>
         <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"/>
           </list>
         </operator>
         <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"/>
       </process>
     </operator>
    </process>
    Regards,
    Matthias
  • wesselwessel Member Posts: 537 Maven
    Ah cool!

    Its even defined on non integers!

    So you don't need to floor stuff.

    Thanks!
Sign In or Register to comment.