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
[Solved] How to address single examples with the script operator?
Dear community,
I recently started to use the script operator. In this context I studied the sample processes.
But now I have another challenge.
(To make the explanation easier the question is simplified. So it might be able to use other operators but in this case I look especially for a script realization.)
The problem: How to access example 4 of attribute "att1", write it to a variable "var" and finally write "var" to example 6.
Looking forward to your comments
Kind regards
Sachs
PS: Is there on overview of all these useful functions like .getStatistics, .getName, etc.?
I recently started to use the script operator. In this context I studied the sample processes.
But now I have another challenge.
(To make the explanation easier the question is simplified. So it might be able to use other operators but in this case I look especially for a script realization.)
The problem: How to access example 4 of attribute "att1", write it to a variable "var" and finally write "var" to example 6.
Looking forward to your comments
Kind regards
Sachs
PS: Is there on overview of all these useful functions like .getStatistics, .getName, etc.?
0
Answers
the "Execute Script" operator essentially can do everything you could do by calling the Java API of Studio.
You will have to work with the Studio API (e.g. in Eclipse) to see what you can do.
Your script in question would be: Note that this implementation will be slow on larger data as it is just an example.
Regards,
Marco
"for (Attribute attribute : exampleSet.getAttributes())"
As a newbie in programming I am not so familiar with the syntax. But this seems to be a for each loop which does multiple things like initializing an iteration variable, getting all the attributes and iterating over all the attributes. Without knowing it better I probably would have done it in three lines.
Meanwhile I also found a kind of documentation, but not sure whether this is official and probably it is not maintained any longer. However, it might help someone out there:
http://fossies.org/dox/rapidminer-5.3.013/interfacecom_1_1rapidminer_1_1example_1_1Attribute.html
Best regards
Sachs