Ponderated Sum Different Attributes

User: "emanuelmcruz"
New Altair Community Member
Updated by Jocelyn

Hi Everybody, i'm new to Rapidminer and i'm doing a project with a Medical database.

I have 17 attributes with values of 1 and 0. Some values have a score of 1, 2, 3 and other 6. I want to create a new attribute which contains the sum of the scores depending on the value of the different attributes.

For example i want to sum the score of Attribute_1 to Attribute_17 only when they are 1 and next i want to sum the different scores of the different Attributes in one new Attribute (Sum Score)

 

I know this must be a easy problem, but i can't seem to find the answer, i tried "generate attribute" and followed a "If-Then" logic, but i can't sum the scores of the different attributes, i can only have the last one positive.

Thank you in advance, i hope you can help me.

Find more posts tagged with

Sort by:
1 - 2 of 21
    User: "lionelderkrikor"
    New Altair Community Member
    Accepted Answer

    Hi again @emanuelmcruz,

     

    If attributes can only have 2 values (0 or 1), you can use the Generate Aggregation operator : 

    <?xml version="1.0" encoding="UTF-8"?><process version="8.2.000">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="8.2.000" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="read_excel" compatibility="8.2.000" expanded="true" height="68" name="Read Excel" width="90" x="45" y="34">
    <parameter key="excel_file" value="C:\Users\Lionel\Documents\Formations_DataScience\Rapidminer\Tests_Rapidminer\Somme_Si\Somme_Si.xlsx"/>
    <parameter key="imported_cell_range" value="A1:G3"/>
    <parameter key="first_row_as_names" value="false"/>
    <list key="annotations">
    <parameter key="0" value="Name"/>
    </list>
    <list key="data_set_meta_data_information">
    <parameter key="0" value="Att1.true.integer.attribute"/>
    <parameter key="1" value="Att2.true.integer.attribute"/>
    <parameter key="2" value="Att3.true.integer.attribute"/>
    <parameter key="3" value="Att4.true.integer.attribute"/>
    <parameter key="4" value="Att5.true.integer.attribute"/>
    <parameter key="5" value="Att6.true.integer.attribute"/>
    <parameter key="6" value="Att7.true.integer.attribute"/>
    </list>
    </operator>
    <operator activated="true" class="generate_aggregation" compatibility="8.2.000" expanded="true" height="82" name="Generate Aggregation" width="90" x="179" y="34">
    <parameter key="attribute_name" value="sum"/>
    </operator>
    <connect from_op="Read Excel" from_port="output" to_op="Generate Aggregation" to_port="example set input"/>
    <connect from_op="Generate Aggregation" 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>

    I hope it helps,

     

    Regards,

     

    Lionel

     

    User: "Telcontar120"
    New Altair Community Member
    Accepted Answer

    Counting the positives is the same as computing the sum if your possible values are only zero or one.  So "Generate Aggregation" across your 17 attributes with the function "sum" should do the trick for you.