[SOLVED] Converting Numerical to Nominal data types, with content replaced

transformers123
transformers123 New Altair Community Member
edited November 5 in Community Q&A
Hello All,
I'm new to RapidMiner and while I was experimenting with it, I was not sure of how to do the following process....

I'm making use of Golf Data in Samples provided.
I want to convert the temperature & humidity to nominal form i.e.,
temp <=75 => cool
temmp > 75 and temp <= 85 => medium
temp > 85 hot
similarly with humidity.
i tried to use the numerical to nominal option, but it doesn't seem to work that way.
Is there an option to use?
Thanks in advance.
Tagged:

Answers

  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    you can use the "Generate Attributes" operator for that. Because you are changing a numerical attribute to a nominal one, you cannot overwrite the same attribute, so you have to create a new one. The old one could be removed via "Select Attributes". See the following example process:

    <?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="retrieve" compatibility="5.3.013" expanded="true" height="60" name="Retrieve Golf" width="90" x="45" y="30">
            <parameter key="repository_entry" value="//Samples/data/Golf"/>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="5.3.013" expanded="true" height="76" name="Generate Attributes" width="90" x="179" y="30">
            <list key="function_descriptions">
              <parameter key="Temperature_Nominal" value="if (Temperature&lt;=75, &quot;cool&quot;, if (Temperature&gt;=85, &quot;hot&quot;, &quot;medium&quot;))"/>
            </list>
          </operator>
          <connect from_op="Retrieve Golf" 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,
    Marco
  • transformers123
    transformers123 New Altair Community Member
    Cool... That Helped.
    Thanks  :)