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
Generate Aggregation - Problem with non-existent attributes
Hello everybody,
I'm just trying to build some custom scoring functions (mainly with the "Generate Attributes" operator). Among other things I need to calculate with some word occurences. At the moment there is an example set with all the attributes from a previously created word vector. Now I want to sum up the occurrences of some similar words and store this value in a new attribute. As far as I know this can easily be done by the "Generate Aggregation" operator. Setting "regular_expression" as attribute filter type and using an expression for those similar words first seemed to work well for me. Adding some more expressions finally led to an error: "AttributeFactory: cannot create attribute with value type 'attribute_value' (0)!". This message results from regular expressions for attribute search which don't bring up any matches. Is this behavior intended? Since I don't know if the words fitting to my regex patterns are present in documents that shall be testet I would prefer a default value (0 for my sum aggregation). How can i avoid this problem? Do I need to check the existence of the desired attributes before (perhaps with "Select attributes" and somehow count the size of the resulting attribute set)? I hope my problem is understandable, it's more of a general question than a process specific problem. I would appreciate any hints and help.
Thanks in advance!
Matthias
I'm just trying to build some custom scoring functions (mainly with the "Generate Attributes" operator). Among other things I need to calculate with some word occurences. At the moment there is an example set with all the attributes from a previously created word vector. Now I want to sum up the occurrences of some similar words and store this value in a new attribute. As far as I know this can easily be done by the "Generate Aggregation" operator. Setting "regular_expression" as attribute filter type and using an expression for those similar words first seemed to work well for me. Adding some more expressions finally led to an error: "AttributeFactory: cannot create attribute with value type 'attribute_value' (0)!". This message results from regular expressions for attribute search which don't bring up any matches. Is this behavior intended? Since I don't know if the words fitting to my regex patterns are present in documents that shall be testet I would prefer a default value (0 for my sum aggregation). How can i avoid this problem? Do I need to check the existence of the desired attributes before (perhaps with "Select attributes" and somehow count the size of the resulting attribute set)? I hope my problem is understandable, it's more of a general question than a process specific problem. I would appreciate any hints and help.
Thanks in advance!
Matthias
Tagged:
0
Answers
Context vectors can be used to work out which words are similar to which other words, in the same way that they can be used to postulate similarity between documents.
thank you for this additional information. Perhaps context vectors might become useful later...
But for now I still need to know a good way to use "Generate Aggregation" with sum or count function for a set of attributes that is defined by a simple regex. It may in fact happen that no matching attributes will be found so I need a possibility to avoid errors resulting from this case. I just tried to solve this with pre-checking the existence of the desired attribute-regex but the way I chose can't be the right one (hopefully).
I used "Select Attributes" with the same regex to get a list of matching attributes. I just didn't find a simple way to count attributes, but I think there is a solution that I simply didn't find. To be able to work on for the moment, I added an empty dummy attribute to avoid the same problem with the following "Generate Aggregation" (filter type: all, aggregation function: count), which should simply count all existing regular attributes. Combined with some mad "Multiply" connections and "Branch" Operators this leads to the desired result (adding a sum aggregation attribute only if matching terms for the regex exist in the word vector). But this definitly isn't the way to go, please help me to clean up my process again
Thanks,
Matthias
Here's how to count the attributes that fill the bill.. Just to be clear about my previous reference to context-vectors, the example set that results from the RM document processes is a context-vector because it has a document identifier field, and a word-vector. If you can specify up front which similarities you are interested in then you can regex, if you don't you can use the context vectors to work some form of similarity for you.
I was expecting to find some counting feature within the "Select Attributes" operator. I didn't look at the "Extract Macro" in this context. I think there is some practical experience required to get familiar with the important operators and getting a feeling for their efficient usage. As soon as you solve one problem there is a new one already waiting (new topic). Hope you have some patience with beginners
Glad to have been of some use ;D Given the large number of operators, most users only gain familiarity with the operators appropriate for their domain, which tends to mean they are restricted by their pre-conceptions. That's why I bother with this forum, it makes me look into the other areas - only rarely do you get acknowledgement, let alone thanks! I am a grumpy old fart and don't bother to answer those who can't be bothered to help themselves - unlike the RM staffers who are saintly in their tolerance, young, and actually know something... bastards
to continue our holy mission to bring some enlightenment to those who are no bastards or blessed with knowledge, let me add:
If an operation can fail regularly, it might be appropriate to use the Handle Exception operator to get rid of this error and continue process execution. All you have to do is to ensure the rest of the process runs just fine. Usually a process branch helps a lot on this mission...
Greetings,
Sebastian