O'Reilly logo

Hands-On Neural Network Programming with C# by Matt R. Cole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required