Using Row Aggregator for Weighted Average

Trying to use Row Aggregator to generate weighted averages and am getting some weird results. As a test, I started with a simple table with five rows where the first column (Weight) is a counter with values 1 to 5 and the second (Value) has a value of 3 for every row. I would expect the weighted average would be 3, but the result I’m getting is 9

Here is the configuration of the node:

It appears that the node is taking the sum of the products of each Weight, Value pair (45) and dividing by the number of rows (5). A proper weighted average would be to divide that sum by the total of the weights (15) which would result in a value of 3. I’ve tried this with a number of data sets and every test bears this out.

Is there something wrong with my configuration?

1 Like

Hello @Bytecrawler ,

I can reproduce. It looks like a problem with the node. I push to get this fixed with the next release. (Internal ticket reference AP-21398).

Thank you for reporting,
nan

2 Likes

Version 5.2 released yesterday includes a fix for this problem. Thank you again @Bytecrawler .

1 Like

It will also be part of KNIME AP 5.1.3, once that is released.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.