[R] Saving model and other objects from caret

Michael Weylandt michael.weylandt at gmail.com
Thu Feb 7 23:00:58 CET 2013



On Feb 7, 2013, at 9:51 PM, James Jong <ribonucleico at gmail.com> wrote:

> Thanks Stephan. I can't believe I didn't try that first. I greatly
> appreciate it.
> 
> James
> 
> 
> On Thu, Feb 7, 2013 at 4:45 PM, Stephan Kolassa <Stephan.Kolassa at gmx.de>wrote:
> 
>> Have you looked at ?save and ?load?

I generally prefer their *RDS counterparts which allow more control over the loading phase and avoid clobbering in the global env. 

M

>> 
>> As I already wrote here: http://stackoverflow.com/**
>> questions/14761496/saving-and-**loading-a-model-in-r<http://stackoverflow.com/questions/14761496/saving-and-loading-a-model-in-r>
>> 
>> Best,
>> Stephan
>> 
>> 
>> 
>> 
>> On 07.02.2013 22:33, James Jong wrote:
>> 
>>> Say I train a model in caret, e.g.:
>>> 
>>> RFmodel <- train(X,Y,method='rf',**trControl=myCtrl,tuneLength=1)
>>> 
>>> How can I save this to disk and load it later in R?
>>> 
>>> How about an object of the class "resamples"?
>>> 
>>> resamps <- resamples(
>>>         list(   RF = RFmodel,
>>>                 SVM = SVMmodel,
>>>                 KNN = KNNmodel,
>>>                 NN = NNmodel
>>>                 ))
>>> 
>>> Thanks,
>>> 
>>> James
>>> 
>>>        [[alternative HTML version deleted]]
>>> 
>>> ______________________________**________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>> PLEASE do read the posting guide http://www.R-project.org/**
>>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list