Pages: [1]
  Print  
Author Topic: Getting the name of minimum-value attribute  (Read 943 times)
Shubha
Full Member
***
Posts: 141


« on: June 08, 2009, 03:36:46 PM »

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:

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>
Logged
haddock
Hero Member
*****
Posts: 853



WWW
« Reply #1 on: June 08, 2009, 04:56:50 PM »

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="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>
Logged

Where is the wisdom we have lost in knowledge?
Where is the knowledge we have lost in information?

T.S.Eliot ~ Choruses from the Rock 1934
Shubha
Full Member
***
Posts: 141


« Reply #2 on: June 09, 2009, 06:39:18 AM »

Thank you very much...
Logged
Pages: [1]
  Print  
 
Jump to: