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
how to modify attribute value in one exampleset based on some condition
I have two examplesets. I check if attribute value in second exampleset inside attribute in first exampleset. then I want to add some data to a new attribute in first exampleset based on comparsion
exampleset first: exampleset second:
id word total id word rate
1 cat 3 1 cat 2
2 dog 5 2 cattle 8
3 rat 4
4 pig 3
5 fish 6
compare word attribute of two examplesets, and find "cat" in both exampleset "word" attribute. so I want my result likes:
exampleset first:
id word total new_total
1 cat 3 6
2 dog 5 5
3 rat 4 4
4 pig 3 3
5 fish 6 6
the "new_total" are calculated by "total"*"rate" if words exsit in both exampleset, otherwise copy "total" to "new_total".
Could someone tell me which operator I should use?
Thank you very much.
exampleset first: exampleset second:
id word total id word rate
1 cat 3 1 cat 2
2 dog 5 2 cattle 8
3 rat 4
4 pig 3
5 fish 6
compare word attribute of two examplesets, and find "cat" in both exampleset "word" attribute. so I want my result likes:
exampleset first:
id word total new_total
1 cat 3 6
2 dog 5 5
3 rat 4 4
4 pig 3 3
5 fish 6 6
the "new_total" are calculated by "total"*"rate" if words exsit in both exampleset, otherwise copy "total" to "new_total".
Could someone tell me which operator I should use?
Thank you very much.
Tagged:
0
Best Answers
-
MartinLiebig Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,533 RM Data ScientistHi,looks like you want to left join the second on the first, replace mssings on the rate with 1 andthen use Generate Attributes to generate your product.Best,Martin- Sr. Director Data Solutions, Altair RapidMiner -
Dortmund, Germany0 -
MartinLiebig Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,533 RM Data ScientistHi,you can just name the newly generated attribute total and it then overwrites the old one with the new one.Best,Martin- Sr. Director Data Solutions, Altair RapidMiner -
Dortmund, Germany0
Answers
your answer is very helpful.
I have another question. If I do not generate "new_total" attribute in above example, just modify the first exampleset "total" attribute with "total"*"rate" when words exsit in both examplesets, is there any other operator I can use? Generate Attributes operator will create a new attribute. so for above example, I should delete "total" attribute later.