macros

gutompf
gutompf New Altair Community Member
edited November 5 in Community Q&A
I do not catch yet how to work with macros in rapidminer - isn't some explanation somewhere?
E.g. how to do this: I want to read data e.g. from excel and one column will be feature a and another feature b. How can I do c = a +b and sent it to results? Is it possible? Or for something other are macros meant in RM?
Thanks
Tagged:

Answers

  • IngoRM
    IngoRM New Altair Community Member
    Hi,

    actually, Macros are not necessary for this type of feature (attribute) generation. Just load your data and use the operator "Generate Attributes" with a formula like "a + b". The following process gives you an example:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.1.008">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.1.008" expanded="true" name="Process">
        <process expanded="true" height="190" width="279">
          <operator activated="true" class="retrieve" compatibility="5.1.008" expanded="true" height="60" name="Retrieve" width="90" x="45" y="30">
            <parameter key="repository_entry" value="//Samples/data/Iris"/>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="5.1.008" expanded="true" height="76" name="Generate Attributes" width="90" x="179" y="30">
            <list key="function_descriptions">
              <parameter key="new_attribute" value="a1+a2"/>
            </list>
          </operator>
          <connect from_op="Retrieve" 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>
    Just go to the XML view of your process, paste the code above into the view and press the green check icon. This will update your current process to the one above.

    More information can be found in our blog:

    http://rapid-i.com/component/option,com_myblog/show,New-GUI-for-Generate-Attributes-Calculator-Style.html/Itemid,172/
    http://rapid-i.com/component/option,com_myblog/show,Extended-Operations-for-Nominal-Values.html/Itemid,172/
    http://rapid-i.com/component/option,com_myblog/show,Preview-New-Date-Functions-for-Attribute-Generation.html/Itemid,172/

    Cheers,
    Ingo