Calling R from Java - Faster alternative to RCaller

只谈情不闲聊 提交于 2019-12-10 14:52:38

问题


I tried RCaller 2.0 to call R functions from Java and I managed to make it work after a few tries. Integration was pretty easy but RCaller is kinda slow at runtime. I'm afraid that RCaller 2.0 won't be suitable for my application since I have to repeatedly call the same script thousands of times and the latency introduced by this library is unacceptable for my needs.

Is there a faster (in terms of run-time execution time) alternative for calling R scripts from Java?


回答1:


Is there any way to push some of the iteration over into R, so that you're calling it much less often? Maybe you can pass in an array of data, with an array of scripts to run, where you're passing them in one by one now.




回答2:


Rcaller has many performance improvements that came with the version 2.1. It now supports passing commands to R in a loop using a single R process. That is, there is no more system calls after the initializing process.




回答3:


Have a look at the test file in RCaller source tree: https://code.google.com/p/rcaller/source/browse/RCaller/src/test/java/rcaller/RunOnlineTest.java

This test file includes sequential commands that run on a single R process. This way is said to be fast.




回答4:


Try Renjin, it seems pretty fast at least!



来源:https://stackoverflow.com/questions/7435619/calling-r-from-java-faster-alternative-to-rcaller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!