Re: [R] how to preserve trained model in LDA?

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu, 31 May 2007 07:27:57 +0100 (BST)

On Wed, 30 May 2007, Feng Qiu wrote:

> Hi all:
>
> I'm developing an application in which I use standard data to
> train the model in LDA and use the trained model to predict on test data. I
> can't train the model every time when I do prediction. So I need to save the
> trained model onto disk after the first training. Does anybody have idea
> about this? You help is highly appreciated.

The object lda() returns (assuming you are using lda) is all you need to do prediction. So just use save() to 'save it to disk', and load() to retrieve it when you need it again.

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help_at_stat.math.ethz.ch 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.
Received on Thu 31 May 2007 - 06:40:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 31 May 2007 - 07:33:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.