Community & Support
Learn
Marketplace
Menu
Menu
Home
›
Discussions
›
Community Q&A
how to generate an attribute with abs(col1 - col2)
blatoo
New Altair Community Member
Apr 29, 2015
Updated
Nov 5, 2024
by
Jocelyn
Hello,
how can I generate an new attribute, which function expression is: |attr1 - attr2| ?
At moment, i just find the way with if( attr1 - attr2 > 0, attr1 - attr2, attr2-attr1)
Thanks very much for the attention!
Find more posts tagged with
AI Studio
All Replies
Sort by:
Sort by
Oldest
▾
1 - 4 of 4
↑
1
↑
Marco_Boeck
New Altair Community Member
Apr 30, 2015
Hi,
because there is no explicit function to get absolute values at the moment, I'd suggest the following:
sqrt(pow((attr1-attr2), 2))
Edit: I concede! See Marius' answer below
Regards,
Marco
MartinLiebig
Altair Employee
Apr 30, 2015
you can use the sign function
sgn(a-b)*(a-b)
for some reason that one is not in the list of Generate Attributes.
MariusHelf
New Altair Community Member
Apr 30, 2015
blatoo,
why not simply use your subject line?
abs(attr1-attr2) will also work perfectly in Generate Attributes
~Marius
blatoo
New Altair Community Member
OP
May 6, 2015
Hi all,
Thanks very much for the answers! :-) I got now more solutions. But I think, if rapidminer can put the abs() also in the function list, will be better. Because abs() will be often used.
Quick Links
All Categories
Recent Discussions
Activity
Unanswered
日本語 (Japanese)
한국어(Korean)
because there is no explicit function to get absolute values at the moment, I'd suggest the following: Edit: I concede! See Marius' answer below
Regards,
Marco