[R] Calling a stored model within the predict() function
Jim_S
virtualreal at gmail.com
Sun Apr 27 01:14:22 CEST 2008
Hi all,
First of all, I'm a novice R user (less that a week), so perhaps my code
isn't very efficient.
Using the MBoost package I created a model using the following command and
saved it to a file for later use:
model <- gamboost(fpfm,data=SampleClusterData,baselearner="bbs") # Creating
a model
save(model,file="model.RData") # Saving a model
After this, during a new R session, I want to deploy this model:
setwd("Q:/Program Files/R/library/mboost/data")
NewData <- read.table("NewData.txt",header=TRUE,sep=,",") #Calling a new
data set
setwd("Q:/Program Files/R/library/mboost")
model <- load("model.rdata") # Loading the model
This won't work. When I check the content of the 'model' object, the only
screen output I see is :
"model
[1]model"
...and that the actual file size from 'model.rdata' is exactly 4,100 kb (is
this a limit?!)
Then I try to call this model object with the predict() function:
CRPredict <- predict(model, newdata= SampleClusterData) # Make the
predictions
This results in the following error message:
"Error in UseMethod("predict") : no applicable method for "predict" "
Is the a correct way to store and call a model or is it only possible to
create & deploy a model during the same R session?
Thanks!
Jim
--
View this message in context: http://www.nabble.com/Calling-a-stored-model-within-the-predict%28%29-function-tp16918111p16918111.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list