The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

"An error in aggregation operator kmeans"

ShubhaShubha Member Posts: 139 Maven
edited June 2019 in Help
Hi,

This is my code:

<operator name="Root" class="Process" expanded="yes">
    <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
        <parameter key="number_examples" value="25"/>
        <parameter key="target_function" value="random"/>
    </operator>
    <operator name="AttributeFilter" class="AttributeFilter">
        <parameter key="condition_class" value="attribute_name_filter"/>
        <parameter key="parameter_string" value="att.*"/>
    </operator>
    <operator name="KMeans" class="KMeans">
        <parameter key="k" value="3"/>
    </operator>
    <operator name="Aggregation" class="Aggregation">
        <list key="aggregation_attributes">
          <parameter key="att1" value="average"/>
        </list>
        <parameter key="group_by_attributes" value="cluster"/>
    </operator>
</operator>


I get the error that the attribute 'cluster' does not exist. But after running the kmeans, a new attribute 'cluster' was created in the exampleset. So, why is this error? Or is it reading the initial input example set ? How do i tell RM to read that particular data which was generated by applying the kmeans?

Thanks, Shubha
Tagged:

Answers

  • TobiasMalbrechtTobiasMalbrecht Moderator, Employee-RapidMiner, Member Posts: 295 RM Product Management
    Hi Shubha,

    this error happens because the [tt]Aggregation[/tt] operator only searches through the regular attributes when matching attribute names. We will add a parameter [tt]work_on_special[/tt] in the near future. Until then you have to change the type of the cluster attribute to regular before applying the [tt]Aggregation[/tt].

    Kind regards,
    Tobias
  • ShubhaShubha Member Posts: 139 Maven
    Thanks Tobias! That exactly did my job...

    One more question, can i specicy all the variables namely (att1, att2, att3, att4, att5) in the aggregate function? (in the above code i posted, only att1 is used). I tried by using the regular expression, att.*. But there is an error, "The attribute 'att.*' doesn't exist". I am sure that i am missing something... What could it be?

    Thanks again,
    Shubha
  • TobiasMalbrechtTobiasMalbrecht Moderator, Employee-RapidMiner, Member Posts: 295 RM Product Management
    Hi Shubha,
    Shubha wrote:

    One more question, can i specicy all the variables namely (att1, att2, att3, att4, att5) in the aggregate function? (in the above code i posted, only att1 is used). I tried by using the regular expression, att.*. But there is an error, "The attribute 'att.*' doesn't exist". I am sure that i am missing something... What could it be?
    You can specify more. You just have to extend the list and therewith specify more than one aggregation attribute and function. Please see the attached code:

    <operator name="Aggregation" class="Aggregation">
        <list key="aggregation_attributes">
          <parameter key="att1"  value="average"/>
          <parameter key="att2"  value="average"/>
        </list>
        <parameter key="group_by_attributes"  value="cluster"/>
    </operator>
    Regards,
    Tobias
  • ShubhaShubha Member Posts: 139 Maven
    Thank you very much...
  • ShubhaShubha Member Posts: 139 Maven
    Was just thinking if I could avoid adding each variable for aggregation. Instead, can I specify all the variables which needs to be aggregated by a regular expression or so?

    Thanks, Shubha
  • haddockhaddock Member Posts: 849 Maven
    Sure
    <operator name="Root" class="Process" expanded="yes">
        <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
            <parameter key="number_examples" value="25"/>
            <parameter key="target_function" value="random"/>
        </operator>
        <operator name="AttributeFilter" class="AttributeFilter">
            <parameter key="condition_class" value="attribute_name_filter"/>
            <parameter key="parameter_string" value="att.*"/>
        </operator>
        <operator name="KMeans" class="KMeans">
            <parameter key="k" value="3"/>
        </operator>
        <operator name="AttributeAggregation" class="AttributeAggregation">
            <parameter key="aggregation_attributes" value="at.*"/>
            <parameter key="attribute_name" value="nu"/>
        </operator>
    </operator>
  • ShubhaShubha Member Posts: 139 Maven
    Thanks,

    This does different i guess. But, surely this will answer another question of mine. AttributeAggregation is something which I learnt new today. Thanks.

    What i need was for each group of nominal cluster attribute, i need the average of all the 'att' attributes, (i.e., The above can do averages row-wise, but actually i need column-wise) without actually specifying each of the variables.

    Secondly, unlike 'Aggregation', the operator 'AttributeAggregation' will not perform the operation groupwise.

    Thirdly, if my attrubutes have different names, unlike att1, att2,... i cant use the regular expressions too...


    Thanking you,
    Shubha
  • haddockhaddock Member Posts: 849 Maven
    Oh dear, so wrong on so many levels, as the following shows.
    <process version="4.3">

      <operator name="Root" class="Process" expanded="yes">
          <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
              <parameter key="number_examples" value="200"/>
              <parameter key="number_of_attributes" value="4"/>
              <parameter key="target_function" value="random"/>
          </operator>
          <operator name="ExampleSetTranspose" class="ExampleSetTranspose">
          </operator>
          <operator name="AttributeAggregation" class="AttributeAggregation">
              <parameter key="aggregation_attributes" value="at.*"/>
              <parameter key="aggregation_function" value="average"/>
              <parameter key="attribute_name" value="Mmm"/>
          </operator>
          <operator name="FeatureNameFilter" class="FeatureNameFilter" breakpoints="after">
              <parameter key="skip_features_with_name" value="at.*"/>
          </operator>
          <operator name="ExampleSetTranspose (2)" class="ExampleSetTranspose">
          </operator>
      </operator>

    </process>

  • ShubhaShubha Member Posts: 139 Maven
    Thank you very much...  :) Transpose was exactly what i thought too... I was just thinking if the examples/observations were too many,will  this method be OK? And also, again trasposing.... Wanted to confirm from you experts, if I am missing some useful operators specially made for these purposes...

    I can also see the application of feature here.. :)... Many Thanks for clearing all my queries...



Sign In or Register to comment.