I have created a model using C50 library in R for classifying emails into various categories. I now want to use the model for classifying new incoming emails in real time using R predict via java. I am not sure how I can save the model from R and load it in another R instance that is used with Java.
Is there any way to save the model to a file and then load the file into R to get the model back for prediction?
This post has your answer to how to save a model (which is a java object) into a file, and then later load that file back again:
library(RWeka) j48.model <- J48(formula=class ~ ., data=data) library(rJava) .jcache(j48.model$classifier) save(j48.model, file="j48.model.rda")