[R] how to preserve trained model in LDA?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu May 31 08:27:57 CEST 2007

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

More information about the R-help mailing list