Options

[SOLVED] Set label to attribute name...

EquationDocEquationDoc Member Posts: 2 Contributor I
edited November 2018 in Help
Let's say I have an example set with a label attribute (initially blank) and some reals...maybe:
RowLabelAtt1Att2Att3
11.31.11.2
22.02.12.2
33.03.23.1
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:
RowLabelAtt1Att2Att3
1Att11.31.11.2
2Att32.02.12.2
3Att23.03.23.1
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

Answers

  • Options
    EquationDocEquationDoc Member Posts: 2 Contributor I
    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.

    John
Sign In or Register to comment.