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.

Generate new multiple attributes!!!

ShiwaaniShiwaani Member Posts: 7 Contributor II
edited November 2018 in Help
There are 3 attributes namely ID LISTINGS CURRENTVALUE...I need to report for every record, LISTINGS which lies between 0.8 and 1.8 of the CURRENTVALUE.

I would hope to generate a new attribute to hold each LISTING whose value lies in the following range(0.8 to 1.8 of the CurrentValue).

Thx

Answers

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager
    Hello yes generate attribute operator is correct. The expression should be something like:

    if(CURRENTVALUE>0.8&&CURRENTVALUE<1.8,LISTINGS,"")

    Scott
  • ShiwaaniShiwaani Member Posts: 7 Contributor II
    Thank you Scott for the reply,but I require the system to loop through the CurrentValue (for each record) and provide me with an array of Listings.

    -Shiwaani
  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager
    Can you show me a piece of your example set?
  • ShiwaaniShiwaani Member Posts: 7 Contributor II
    Dataset     
    ID  Listing  Current Value
    11A  ABC        600
    12A  DEF        400
    13A  GHI        800
    14A  JKL        200
    15A  MNO    1200

                          Range 
    .8*CurrentValue  1.8*CurrentValue
    480                            1080
    320                            720
    640                            1440
    160                            360
    960                            2160

    Desired output             
    ID        Listing          Current Value  NewVar1      NewVar2    NewVar3
    11A      ABC            600                    ABC              GHI 
    12A      DEF            400                    DEF            ABC 
    13A      GHI            800                      GHI              MNO 
    14A    JKL            200                    JKL     
    15A    MNO          1200                  MNO     
  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager
    ok I don't think this is the most elegant solution (and the results are transposed from what you want) but here you go:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="6.5.002">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="6.5.002" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="retrieve" compatibility="6.5.002" expanded="true" height="60" name="Retrieve FOO" width="90" x="45" y="75">
            <parameter key="repository_entry" value="//Local Repository/FOO"/>
          </operator>
          <operator activated="true" class="remember" compatibility="6.5.002" expanded="true" height="60" name="Remember" width="90" x="179" y="75">
            <parameter key="name" value="exampleset"/>
          </operator>
          <operator activated="true" class="loop_examples" compatibility="6.5.002" expanded="true" height="76" name="Loop Examples" width="90" x="313" y="75">
            <process expanded="true">
              <operator activated="true" class="extract_macro" compatibility="6.5.002" expanded="true" height="60" name="Extract Macro" width="90" x="45" y="30">
                <parameter key="macro" value="currentvalue"/>
                <parameter key="macro_type" value="data_value"/>
                <parameter key="attribute_name" value="Current Value"/>
                <parameter key="example_index" value="%{example}"/>
                <list key="additional_macros"/>
              </operator>
              <operator activated="true" class="generate_macro" compatibility="6.5.002" expanded="true" height="76" name="Generate Macro" width="90" x="179" y="30">
                <list key="function_descriptions">
                  <parameter key="lowerbound" value="eval(%{currentvalue})*0.8"/>
                  <parameter key="upperbound" value="eval(%{currentvalue})*1.8"/>
                </list>
              </operator>
              <operator activated="true" class="recall" compatibility="6.5.002" expanded="true" height="60" name="Recall" width="90" x="179" y="165">
                <parameter key="name" value="exampleset"/>
                <parameter key="remove_from_store" value="false"/>
              </operator>
              <operator activated="true" class="generate_attributes" compatibility="6.5.002" expanded="true" height="76" name="Generate Attributes" width="90" x="313" y="165">
                <list key="function_descriptions">
                  <parameter key="NewVar%{example}" value="if([Current Value]&gt;eval(%{lowerbound})&amp;&amp;[Current Value]&lt;eval(%{upperbound}),[Listing],&quot;&quot;)"/>
                </list>
              </operator>
              <operator activated="true" class="remember" compatibility="6.5.002" expanded="true" height="60" name="Remember (3)" width="90" x="447" y="165">
                <parameter key="name" value="exampleset"/>
              </operator>
              <connect from_port="example set" to_op="Extract Macro" to_port="example set"/>
              <connect from_op="Extract Macro" from_port="example set" to_op="Generate Macro" to_port="through 1"/>
              <connect from_op="Recall" from_port="result" to_op="Generate Attributes" to_port="example set input"/>
              <connect from_op="Generate Attributes" from_port="example set output" to_op="Remember (3)" to_port="store"/>
              <portSpacing port="source_example set" spacing="0"/>
              <portSpacing port="sink_example set" spacing="0"/>
              <portSpacing port="sink_output 1" spacing="0"/>
            </process>
          </operator>
          <operator activated="true" class="recall" compatibility="6.5.002" expanded="true" height="60" name="Recall (3)" width="90" x="514" y="75">
            <parameter key="name" value="exampleset"/>
            <parameter key="remove_from_store" value="false"/>
          </operator>
          <connect from_op="Retrieve FOO" from_port="output" to_op="Remember" to_port="store"/>
          <connect from_op="Remember" from_port="stored" to_op="Loop Examples" to_port="example set"/>
          <connect from_op="Recall (3)" from_port="result" 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>
  • ShiwaaniShiwaani Member Posts: 7 Contributor II
    Thx Scott, I was hoping for a operator based response ,yet I will give this a try.
Sign In or Register to comment.