Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.
Generate Attribute for binomials
The "Generate Attributes" operator allows to define an if() statement as an expression on attributes that does not seem to work on binominals in Rapid 5.2.003
For example, the binominal attribute for a simple traffic light is color={RED, GREEN}, and i would like to generate a new attribute 'drive' with values {STOP, GO}.
The Generate Attributes operator has a new attribute = "drive" and function expression = "if(color=RED,STOP,GO)".
Running this results in a Process Failed window with the message "Generation exception:"No such attribute: "STOP"
An operator failed to generate a new attribute, macro or other object which is calculated on the fly. Reason: No such attribute: 'STOP'"
Since the on-line help does not exclude binomials attributes, i suppose is should work, somehow.
Does anyone know how to?
For example, the binominal attribute for a simple traffic light is color={RED, GREEN}, and i would like to generate a new attribute 'drive' with values {STOP, GO}.
The Generate Attributes operator has a new attribute = "drive" and function expression = "if(color=RED,STOP,GO)".
Running this results in a Process Failed window with the message "Generation exception:"No such attribute: "STOP"
An operator failed to generate a new attribute, macro or other object which is calculated on the fly. Reason: No such attribute: 'STOP'"
Since the on-line help does not exclude binomials attributes, i suppose is should work, somehow.
Does anyone know how to?
Tagged:
0
Answers
I think you need a double equals (==) and to quote the values, like this... I recommend the little wizard that helps with the regex in the generating operator, it sure helps..
Good weekend
Thanks for the help. The quotes solves the problem: if(color=="RED","STOP","GO")
The '==' was just a typo in my post indeed.
Interesting why the error was generated for the second erroneous value (STOP) and not for the first in the comparison operation (RED).
The wizard may be useful but i did not bother to define the value type of the import data, and apparently the wizard ignores the binominal values in the Attributes list, and also does not mind whether you use quotes or not (RED or "RED" are both OK).