RcppShark Random Forest example throws exception about the random number generator

213 views Asked by At

I followed this example:

https://www.2021.ai/randsharkmachinelearning/

when running this command on R:

sharkFit <- SharkRFTrain(X, Y, nTrees = 100)

I get:

Error in SharkRFTrain(X, Y, nTrees = 100) : 
  Should not call this. Fix the random numbers generator if you need this. 478

This exception is thrown from this "cpp" line:

trainer.train(model, trainData);

I suspect the reason is written here:

https://github.com/aydindemircioglu/RcppShark#notes

The random number generator was replaced, as R packages must use the random generator from R and not the C/C++ internal one. Thereffore, a direct comparison of results of algorithms that depend on (pseudo) random numbers cannot be done.

Is there a way to mitigate this?

tried both R versions: 3.4.1, 3.3.2

1

There are 1 answers

0
Ralf Stubner On BEST ANSWER

I have investigated this and was able to narrow it down to some degree:

Since I was not able to fix it, I have opened an issue here: https://github.com/aydindemircioglu/RcppShark/issues/1