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
"Loop Attributes - Expression Evaluation Error"
I'm using 2 separate Loop Attributes Operator, each containing a Generate Attribute Operator.
Attribute Name(Inside Generate Attribute) for both Loop Attributes Operator: %{loop_attribute}
However, this error popped out.
Expression Evaluation Error: The function 'eval' failed to parse the subexpression '203_10'. Cause: token recognition error at '_' .
Initially, I thought that by removing the underscore '_' will solve it. But no matter what I did to rename it using the Rename by Replacing operator, it doesn't work. Same error comes up.
Sometimes, the Not Enough Iterations Error pops up as well. I'm confused when I have set the Loop Attribute to subset and have selected the necessary attributes.
Regards,
AY
Attribute Name(Inside Generate Attribute) for both Loop Attributes Operator: %{loop_attribute}
However, this error popped out.
Expression Evaluation Error: The function 'eval' failed to parse the subexpression '203_10'. Cause: token recognition error at '_' .
Initially, I thought that by removing the underscore '_' will solve it. But no matter what I did to rename it using the Rename by Replacing operator, it doesn't work. Same error comes up.
Sometimes, the Not Enough Iterations Error pops up as well. I'm confused when I have set the Loop Attribute to subset and have selected the necessary attributes.
Regards,
AY
Tagged:
0
Best Answers
-
David_A Administrator, Moderator, Employee-RapidMiner, RMResearcher, Member Posts: 297 RM ResearchHi,
the problem here is how macros are parsed.
In your case, first %{loop_attribute} is replaced with the attribute name, this is "2_speed". Then the eval() function tries to make sense of that string as a number or mathematical expression, what fails.
In that case you need to use the seldom used #{loot_attribute} syntax. This returns the value corresponding to that attribute name.
@mschmitz has described it nicely in this posting:
https://community.rapidminer.com/discussion/32966/how-to-use-macros
And congratulations, you are now in the higher echelons of macro handling
Best,
David
6 -
lionelderkrikor RapidMiner Certified Analyst, Member Posts: 1,195 UnicornHi @1705410G,
Can you try to define attribute name as %{loop_attribute} (or something like %{loop_attribute}_bis if you don't want that your initial attributes are removed) instead of #{loop_attribute} :
Hope it helps,
Regards,
Lionel6
Answers
#{loop_attribute} syntax worked!! Thank you!! But the results seems wrong
As mentioned above, i'm using 2 separate Loop Attributes operator.
Attribute filter type is set to subset with about 40 different attributes selected in each Loop Attributes operator.
However, there's only 1 column of results produced by the first loop and second loop (Shown below). Does it means that both Loop Attributes only loop once?
My question is how can I allow the 2 different loops to loop for all selected attributes?
So I should be able to get 80 new columns in total. 40 for the first loop function and 40 for the second loop function.
P.S. How do I get the loop attributes to use back the same name rather than #{loop_attribute} since I have 40 over attributes in each Loop Attribute operator?
Thank you!!
Regards,
AY
It worked! Thank you so much to all that contributed!
@David_A -- thanks for that secret knowledge, it took me an hour of my life to struggle with Loop Attributes before I have found this solution on the forum!
PS one more proof how really useful and helpful RM community can be! MAGIC!
Vladimir
http://whatthefraud.wtf
Dortmund, Germany
'#{macro}' notation is basically okay (if you know about it of course ), but having getValueOf(String attribute) would simplify the process structure in some cases.
Vladimir
http://whatthefraud.wtf