我按照这个例子:
https://www.2021.ai/randsharkmachinelearning/
在R上运行此命令时:
sharkFit <- SharkRFTrain(X, Y, nTrees = 100)
Run Code Online (Sandbox Code Playgroud)
我明白了:
Error in SharkRFTrain(X, Y, nTrees = 100) :
Should not call this. Fix the random numbers generator if you need this. 478
Run Code Online (Sandbox Code Playgroud)
从这个"cpp"行抛出此异常:
trainer.train(model, trainData);
Run Code Online (Sandbox Code Playgroud)
我怀疑原因写在这里:
https://github.com/aydindemircioglu/RcppShark#notes
随机数生成器被替换,因为R包必须使用R中的随机生成器而不是C/C++内部生成器.因此,不能进行依赖于(伪)随机数的算法结果的直接比较.
有没有办法缓解这种情况?
尝试了两个R版本:3.4.1,3.3.2