Java-R集成? [英] Java-R integration?

查看:387
本文介绍了Java-R集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要执行偏最小二乘回归的Java应用程序。看来PLSR没有Java实现。 Weka可能在某些时候有类似的东西,但它不再在API中。另一方面,我发现了一个很好的R实现,它有一个额外的好处。它被我想要复制的人使用,这意味着由于PLSR实施方式的不同,出现问题的可能性较小。

I have a Java app which needs to perform partial least squares regression. It would appear there are no Java implementations of PLSR out there. Weka might have had something like it at some point, but it is no longer in the API. On the other hand, I have found a good R implementation, which has an added bonus to it. It was used by the people whose result I want to replicate, which means there is less chance that things will go wrong because of differences in the way PLSR is implemented.

问题是:是否有足够好(且易于使用)的包使Java能够调用R,将一些参数传递给函数并读回结果?我的另一个选择是让Java在一个进程中生成R然后监视它。数据将被读取并写入磁盘。你会推荐哪两个?我错过了明显的第三种选择吗?

The question is: is there a good enough (and simple to use) package that enable Java to call R, pass in some parameters to a function and read back the results? My other option is to have Java spawn R in a Process and then monitor it. Data would be read and written to disk. Which of the two would you recommend? Am I missing the obvious third option?

推荐答案

我过去成功使用过两种选择。

I have successfully used two alternatives in the past.

JRI

JRI


  • 优点:效果可能更好。

  • 缺点:你必须配置一些环境变量和库,在Win / UNIX中不同。

  • Pros: probably better performance.
  • Cons: you have to configure some environment variables and libraries, different in Win/UNIX.

RServe

RServe


  • 优点:易于设置,您无需初始化R或链接
    任何R库,可以在不同的机器上运行。

  • 缺点:基于TCP / IP(服务器正在运行),没有来自R的回调。

  • Pros: easy to setup, you don't need to initialize R or link against any R library, can run in a different machine.
  • Cons: based on TCP/IP (a server is running), no callbacks from R.

其他替代方案我从未使用过: RCaller

这篇关于Java-R集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆