Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save trained Neural network

I need help with saving my neural network.

I'll explain...i programmed multi-layer network in C#..the part of application is for training and the other part is for testing neural network. Everything works exactly as it should. When i want to train my network i load a set of data from a file. When the training is over i test it on a smaller sample of data and it gives me correct output. But now i would like to be able to train my network and save it, so that i can load it again and use it for further testing.

like image 219
user2923389 Avatar asked Feb 13 '14 11:02

user2923389


1 Answers

I will assume you have your machine learning class called Bayes (or whatever). Typically you would mark this as [Serializable]

using System.IO;
[Serializable]
public class NaiveBayes
{
    ...
}

In this class you could then have a method to do your saving

public void Save(Stream stream)
{
    YourBinaryFormatter b = new YourBinaryFormatter();
    b.Serialize(stream, this);
}

YourBinarySerializer here is just some serializer of your choice, you can use another serializer if you wish. Reading these files is the reverse and is equally as easy.

like image 114
MoonKnight Avatar answered Oct 03 '22 00:10

MoonKnight