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

round real values to the n-th decimal?

Fred12Fred12 Member Posts: 344 Unicorn
edited November 2018 in Help

hi,

is there any operator than can round or cut of some real number on the n-th decimal, e.g on the 5 number after the comma or so?

do this for one or any columns?

Answers

  • Telcontar120Telcontar120 RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,635 Unicorn

    I believe the "round" function available in generate attributes will do what you want quite easily!  

    You also have the 'format numbers' operator but that will turn it into a nominal value.

    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
  • SHSguySHSguy Member Posts: 24 Contributor I

    How do I insert the round in the function expression? 

    Tried using 

    Function expression

    rand(round())

     

    also two separate function expressions no luck 

     

    attribute 1 rand()

    attribute 1 round()

     

    also if maybe you know, how do I limit the random function between two numbers rand(1,5) does not work at all. 

     

    Thank you in advance. 

     

  • Edin_KlapicEdin_Klapic Employee-RapidMiner, RMResearcher, Member Posts: 299 RM Data Scientist

    Hi @SHSguy,

     

    I am not sure what you want to achieve in your first use case.

    If you want to round a random number the order of functions is wrong. It needs to be round(rand(),x) with x being the number of decimals to round to.

     

    Regarding your second question:

    The rand() function always delivers a floating point number between 0 and 1. So one possible solution would be

    rand()*5

     to get values between 0 and 5. If want them rounded to the next integer you would do

    ceil(rand()*5)

    ceil() rounds to the next integer "above"

    floow() rounds to the next integer "below"

     

    Happy Mining,

    Edin

     

    P.S.:

    An explanation to all function is given if you click on the i next to the function (see screenshot) image.png

     

     

     

     

  • SHSguySHSguy Member Posts: 24 Contributor I

    Hi Edin, 

     

    Thank you really appreciate the explanation.

     

    Best Regards,

    Nick

Sign In or Register to comment.