我按照这个例子:
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
随机数生成器已被替换,因为 R 包必须使用 R 中的随机生成器,而不是 C/C++ 内部的随机生成器。因此,无法直接比较依赖于(伪)随机数的算法的结果。
有没有办法减轻这种情况?
尝试了两个 R 版本:3.4.1、3.3.2