简体   繁体   中英

How can I efficiently use an R prediction model from Java?

I have some classification models that I've developed in R with functions like glm, rpart, etc. What's the most computationally efficient way to call those models from Java? I've seen JRI, but that looks like there are lots of text-based calls to R.

Is there a way to use these models from Java with low overhead?

JPMML now has a functional testing module that specifically deals with scoring PMML models that have been developed using R/Rattle: https://github.com/jpmml/jpmml/tree/master/pmml-rattle

JPMML should be able to score decision trees (ie. rpart() function) and neural networks (ie. nnet() function) without problem. The support for generalized regression models (ie. glm() function) is coming soon.

in the Case of GLMs you can translate them to pure Java language with the glm.deploy package

https://cran.r-project.org/web/packages/glm.deploy/index.html

Do you think it is too slow to export them with the pmml package and then use a java based pmml reader like jpmml or Zementis? http://code.google.com/p/jpmml/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM