RapidMiner

RapidMiner

Getting the name of minimum-value attribute

Regular Contributor

Getting the name of minimum-value attribute

Hi,

Suppose I have an exampleset with five attributes att1, att2,....att5. Now, I want to create a new attribute "Group", which contains the attribute names, corresponding to the minimum of the values of att1,...att5.

Example:

att1  att2  att3  att4  att5 Group
1      3      4    -4      2    att4
31    0      1      2      8    att2
-10    4      1    12    5    att1

How do we do this? Or instead of "Group", even just the numbers would also be fine. Like instead of att4, att2,att1 in the above, if one get 4,2,1 that should also be fine.

I have here with attached a code:

<operator name="Root" class="Process" expanded="yes">
    <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
        <parameter key="target_function" value="random"/>
        <parameter key="number_examples" value="10"/>
    </operator>
    <operator name="AttributeAggregation" class="AttributeAggregation">
        <parameter key="attribute_name" value="m"/>
        <parameter key="aggregation_attributes" value="att.*"/>
        <parameter key="aggregation_function" value="minimum"/>
    </operator>
    <operator name="FeatureIterator" class="FeatureIterator" activated="no" expanded="yes">
        <parameter key="filter" value="att.*"/>
        <parameter key="iteration_macro" value="loop"/>
        <parameter key="work_on_input" value="false"/>
        <operator name="AttributeConstruction" class="AttributeConstruction">
            <list key="function_descriptions">
              <parameter key="P" value="if(%{loop} == m,&quot;%{loop}&quot;,1)"/>
            </list>
        </operator>
    </operator>
</operator>
2 REPLIES
Regular Contributor

Re: Getting the name of minimum-value attribute

<operator name="Root" class="Process" expanded="yes">
    <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
        <parameter key="target_function" value="random"/>
        <parameter key="number_examples" value="10"/>
    </operator>
    <operator name="AttributeAggregation" class="AttributeAggregation">
        <parameter key="attribute_name" value="m"/>
        <parameter key="aggregation_attributes" value="att.*"/>
        <parameter key="aggregation_function" value="minimum"/>
    </operator>
    <operator name="Numerical2Polynominal" class="Numerical2Polynominal">
    </operator>
    <operator name="FeatureIterator" class="FeatureIterator" expanded="yes">
        <parameter key="filter" value="att.*"/>
        <parameter key="iteration_macro" value="loop"/>
        <parameter key="work_on_input" value="false"/>
        <operator name="AttributeConstruction" class="AttributeConstruction">
            <list key="function_descriptions">
              <parameter key="P%{a}" value="if(%{loop} == m,&quot;%{loop}&quot;,&quot;X&quot;)"/>
            </list>
        </operator>
    </operator>
    <operator name="Replace" class="Replace">
        <parameter key="attributes" value="P.*"/>
        <parameter key="replace_what" value="att|X"/>
    </operator>
    <operator name="NominalNumbers2Numerical" class="NominalNumbers2Numerical">
    </operator>
    <operator name="AttributeAggregation (2)" class="AttributeAggregation">
        <parameter key="attribute_name" value="Lowest in att"/>
        <parameter key="aggregation_attributes" value="P.*"/>
        <parameter key="aggregation_function" value="average"/>
    </operator>
    <operator name="FeatureNameFilter" class="FeatureNameFilter">
        <parameter key="skip_features_with_name" value="m|P.*"/>
    </operator>
</operator>

Regular Contributor

Re: Getting the name of minimum-value attribute

Thank you very much...