JRI and ARIMA integration

独自空忆成欢 提交于 2019-12-11 15:38:10

问题


I have one last question, but I really need help on this one. The very last thing for my project is that I have to make ARIMA, to work under JRI. All everything is working, but one little piece of code is not working properly. Here's the code:

                            re.eval("library(forecast);");
            re.assign("y", arrayStr);
                re.eval("datats<-y;");


                    re.eval("arima<-auto.arima(datats);");
                    re.eval("fcast<-forecast(arima);");
                REXP fs = re.eval("summary(fcast);");

                    double[] forecast = fs.asDoubleArray();
                    for(int i=0; i<forecast.length; i++)
                    System.out.println(forecast[i]);

I've tried this one too, but it's not working too.

re.eval("sensor<-ts(y,frequency=365)");
            re.eval("library(forecast);");
            //re.eval("sink(\"sink-examp.txt\");");
            //re.eval("is.ts(datats);");
            //re.eval("sink()");
            re.eval("fit <- auto.arima(sensor,D=1);");
            re.eval("LH.pred <- forecast(fit,h=20)");
            //re.eval("sink(\"sink-examp.txt\");");
            //re.eval("sink(summary(test1))");
            REXP result = re.eval("summary(LH.pred)");
            System.out.println(result.asString());

Any advice will be appreciated. Thanks in advance!


回答1:


The reason why this is happening is: You CANNOT transfer a lot of data between both languages. I was supposed to use Oracle DB to move the data without any lost pieces of information.



来源:https://stackoverflow.com/questions/20292159/jri-and-arima-integration

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