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

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

问题描述

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

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

解决方案

我过去曾成功使用过两种替代方案.

JRI

  • 优点:性能可能更好.
  • 缺点:您必须配置一些环境变量和库,在 Win/UNIX 中有所不同.

RServe

  • 优点:易于设置,无需初始化 R 或链接任何 R 库,都可以在不同的机器上运行.
  • 缺点:基于 TCP/IP(服务器正在运行),没有来自 R 的回调.

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

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.

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

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

RServe

  • 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.

Other alternatives I have never used : RCaller

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

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