RcppShark 随机森林示例抛出有关随机数生成器的异常
RcppShark Random Forest example throws exception about the random number generator
我遵循了这个例子:
https://www.2021.ai/randsharkmachinelearning/
当 运行 这个命令在 R:
sharkFit <- SharkRFTrain(X, Y, nTrees = 100)
我得到:
Error in SharkRFTrain(X, Y, nTrees = 100) :
Should not call this. Fix the random numbers generator if you need this. 478
此 "cpp" 行引发此异常:
trainer.train(model, trainData);
我怀疑原因写在这里:
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.
有没有办法缓解这种情况?
尝试了两个 R 版本:3.4.1、3.3.2
我对此进行了调查,并能够在一定程度上缩小范围:
- 此处产生错误信息:https://github.com/aydindemircioglu/RcppShark/blob/master/src/shark/Rng/Runif.h#L71
- 调用代码在这里:https://github.com/aydindemircioglu/RcppShark/blob/master/src/src/Algorithms/RFTrainer.cpp#L178
由于我无法修复它,我在这里打开了一个问题:https://github.com/aydindemircioglu/RcppShark/issues/1
我遵循了这个例子:
https://www.2021.ai/randsharkmachinelearning/
当 运行 这个命令在 R:
sharkFit <- SharkRFTrain(X, Y, nTrees = 100)
我得到:
Error in SharkRFTrain(X, Y, nTrees = 100) :
Should not call this. Fix the random numbers generator if you need this. 478
此 "cpp" 行引发此异常:
trainer.train(model, trainData);
我怀疑原因写在这里:
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.
有没有办法缓解这种情况?
尝试了两个 R 版本:3.4.1、3.3.2
我对此进行了调查,并能够在一定程度上缩小范围:
- 此处产生错误信息:https://github.com/aydindemircioglu/RcppShark/blob/master/src/shark/Rng/Runif.h#L71
- 调用代码在这里:https://github.com/aydindemircioglu/RcppShark/blob/master/src/src/Algorithms/RFTrainer.cpp#L178
由于我无法修复它,我在这里打开了一个问题:https://github.com/aydindemircioglu/RcppShark/issues/1