Options

[SOLVED] Changing Data Values Based on Criteria

rfeigelrfeigel Member Posts: 18 Contributor II
edited November 2018 in Help
I have a column of real values with arbitrary values >0. I would like to replace any value larger than an a number which I can input with a specific value. For example if the number > 100,000, set the number = 100,000. Any help would be appreciated.

Answers

  • Options
    JEdwardJEdward RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 578 Unicorn
    Something like this?  (You can then drop the field you don't want and change the name of the replaced one)
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.013">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.013" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="generate_data" compatibility="5.3.013" expanded="true" height="60" name="Generate Data" width="90" x="45" y="210">
            <parameter key="target_function" value="one variable non linear"/>
            <parameter key="number_of_attributes" value="1"/>
            <parameter key="attributes_lower_bound" value="0.0"/>
            <parameter key="attributes_upper_bound" value="20000.0"/>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="5.3.013" expanded="true" height="76" name="Generate Attributes" width="90" x="179" y="75">
            <list key="function_descriptions">
              <parameter key="Replace" value="if(att1&gt;=10000,-1,att1)"/>
            </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"/>
          <connect from_op="Generate Attributes" from_port="original" to_port="result 2"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
          <portSpacing port="sink_result 3" spacing="0"/>
        </process>
      </operator>
    </process>
  • Options
    rfeigelrfeigel Member Posts: 18 Contributor II
    That's exactly what I needed. Thank you very much.
Sign In or Register to comment.