R Predictor takes too long to execute

Hi,

I have a prediction model, developed in R and saved in R workspace locally (in .RData file).

I want to load this model into KNIME workflow and use it in the workflow for prediction.

So, i use R Source (Workspace) node to load the model from file, and then pass workspace to R Predictor node which i also supply with data for prediction. in R Predictor i use script to predisct values and assign them to knime.out.

Everything works fine, but it takes way too long to execute. I added Timer Info node to get execution time, and it shows 3 seconds for both R Source (Workspace) and R Predictor nodes, about 6 seconds in total.

It is not acceptable duration, if i want to operationalize my workflow via KNIME Server, which i would like to evaluate.

Is there any way to optimize execution time, at least for R Predictor? Why does it take so long? it is a simple call to predict function in script and that's it.

Any advise here?

PS. I tried R Snippet node as well, but it is the same story. And, if I run the same script in R console, it takes less than second.

 

Thank you!

Hi,

Thanks for the detailed feedback. There is always some overhead for moving data between the Java Virtual Machine and the R runtime. In your case one option is to execute the R source node once in order to load the model and cache it. Then only the data to be predicted must be transferred to the R predictor node.

Best,

Jon

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.