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.

How to create a 'real' random value?

kaymankayman Member Posts: 662 Unicorn
Probably overlooking something but I am struggling to get a random record that is actually changing each time. There is the option to get a random sample value, but this always gives me the same one, and same goes for generating a random value using the rand() function. Also here I get the same random number each time, while I want a new one instead.

I simply want to get a single random record out of a recordset, but it should be a different record each time I call the set. 

Any ideas?

Best Answers

Answers

  • kaymankayman Member Posts: 662 Unicorn
    Fair enough, but since there is the option to select a random attribute, it should also be theoretically feasible to select a random record, or have a 'real' random sample, isn't it? Now the only option we have is a 'fixed' random number, which seems kind of limited to me.

    I can of course always use the randint python function also, but it feels like a missing option in Rapidminer to me.
  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,529 RM Data Scientist
    as yy pointed out - there is no "real" random number in CS. The only thing one can do is define the seed as the current timestamp % something or similar. We could of course define a new function which gives you a random random seed, like yy does it. But i am not sure if that makes it better.
    Best,
    Martin
    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • David_ADavid_A Administrator, Moderator, Employee, RMResearcher, Member Posts: 297 RM Research
    Hi,

    setting the seed to something random is probably the best approach to achieve a higher degree of randomness.
    If you, for some reason require a more refined approach, you could also query https://www.random.org/ which API provides "true" randomness based on atmospheric noise.

    Best,
    David
  • kaymankayman Member Posts: 662 Unicorn
    Ok, never thought something seemingly simple as for instance 'give me a different random number between 1 and 10 each time I call you' would be so complex to achieve :-) 

    I'll use the python randint then, thanks to all.
  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,529 RM Data Scientist

    randint gives you also just a pseudo random number.

    Best,
    Martin
    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • kaymankayman Member Posts: 662 Unicorn
    Hi @mschmitz,  maybe there is some confusion here on terminology, with real random I actually mean 'each time a different random number', whereas rapidminer gives me the same (random) number each time again, so not so random - random after all.
    Whether it is pseudo or not doesn't matter, as long as I would get a different random number each time. 

    I would therefore have expected that the rapidminer rand() function would do something similar as using the date or so to emulate some form of randomness, but it appears to be rather static instead.

    Anyway, I combined the suggestions given by yy and David and use a pseudo random seed value for the shuffle operator. Then I get a different order each time, so I just have to pick the first record and this will be different / random enough for my purposes. 

Sign In or Register to comment.