Loading and saving models

SharpLearning makes it very easy to load and save models to disk. This is a very important part of a machine learning library and SharpLearning is among the easiest to implement.

All models in SharpLearning have a Save and a Load method. These methods do the heavy lifting of saving and loading a model for us.

As an example, here we will save a model that we learned to disk:

model.Save(() => StreamWriter(@"C:\randomforest.xml"));

If we want to load this model back in, we simply use the Load method:

varloadedModel = RegressionForestModel.Load(() => newStreamReader(@"C:\randomforest.xml"));

Yep, it’s that easy and simple to load and save your data models. It is also possible for you to save models using serialization. ...

Get Hands-On Neural Network Programming with C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.