[SOLVED] Set label to attribute name...
EquationDoc
New Altair Community Member
Let's say I have an example set with a label attribute (initially blank) and some reals...maybe:
Now for each row, I want to set the Label to be the name of the attribute where the maximal real value occurs, which for the current example would yield:
I have implemented this by aggregating the max of the reals into a new attribute called Max, then looping over attributes, then looping over examples, and seeing if the value is equal to the value stored in Max, and if so using Set Data to store the attribute name in Label.
That works, but I've got O(100) reals and O(1,000) examples, so you can imagine how SSSSSLLLLLLOOOOOOOWWWWWWW it is. Ssssooooo....
The question is, is there a better and faster way to do this?
Any ideas/help would be most appreciated!
John
Row | Label | Att1 | Att2 | Att3 |
1 | 1.3 | 1.1 | 1.2 | |
2 | 2.0 | 2.1 | 2.2 | |
3 | 3.0 | 3.2 | 3.1 |
Row | Label | Att1 | Att2 | Att3 |
1 | Att1 | 1.3 | 1.1 | 1.2 |
2 | Att3 | 2.0 | 2.1 | 2.2 |
3 | Att2 | 3.0 | 3.2 | 3.1 |
That works, but I've got O(100) reals and O(1,000) examples, so you can imagine how SSSSSLLLLLLOOOOOOOWWWWWWW it is. Ssssooooo....
The question is, is there a better and faster way to do this?
Any ideas/help would be most appreciated!
John
Tagged:
0
Answers
-
Ugh. Never mind. Pay no attention to the newb.
One of the attributes that was not part of the processing was a text attribute from a Process Documents (via a checked "keep text") that contained news articles of size O(10K) to O(100K), and presumably there were copies being made in the process of looping and/or filtering.
Once I got rid of that attribute by unchecking "keep text" things sped up considerably (runtime of 2m 47s decreased to 13s).
Ancient wisdom learned anew: Entia non sunt multiplicanda praeter necessitatem.
John0