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
[Solved] Calculation of column sum
Hi All,
I would like to calculate the sum of all values in a row in a dataset while the number of columns can vary. It is a text mining case so that it is not possible to predict the exact number of columns generated by vector creation. I would like to generate a new attribute containing the sum value. the dataset could look like
term; text1; text2; text3
free; 2;3;1
mind; 4;2;8
suggest;3;1;1
telephone;1;0;6
the result should be
term; text1; text2; text3;sum of occ
free;2;3;1;6
mind;4;2;8;14
suggest;3;1;1;5
telephone;1;0;6;7
as I said, the count of texts can vary so as far as I understand it the Generate Attributes operater cannot do the job.
Thanks in advance!
Chris
I would like to calculate the sum of all values in a row in a dataset while the number of columns can vary. It is a text mining case so that it is not possible to predict the exact number of columns generated by vector creation. I would like to generate a new attribute containing the sum value. the dataset could look like
term; text1; text2; text3
free; 2;3;1
mind; 4;2;8
suggest;3;1;1
telephone;1;0;6
the result should be
term; text1; text2; text3;sum of occ
free;2;3;1;6
mind;4;2;8;14
suggest;3;1;1;5
telephone;1;0;6;7
as I said, the count of texts can vary so as far as I understand it the Generate Attributes operater cannot do the job.
Thanks in advance!
Chris
0
Answers
The generate aggregation operator should be fine for this.
Set the attribute filter type parameter to "value_type", the value type parameter to "numeric" and the aggregation function to "sum" in order to make it only work on numeric attributes.
regards
Andrew