Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to store neural network knowledge data?

I am new to that area, so the question may seem strange. However before asking I've read bunch of introductory articles about what are the key points about in machine learning and what are the acting parts of neural networks. Including very useful that one What is machine learning. Basically as I got it - an educated NN is (correct me if it's wrong):

  1. set of connections between neurons (maybe self-connected, may have gates, etc.)
  2. formed activation probabilities on each connection.

Both things are adjusted during the training to fit expected output as close as possible. Then, what we do with an educated NN - we load the test subset of data into it and check how good it performs. But what happens if we're happy with the test results and we want to store the education results and not run training again later when dataset get new values.

So my question is - is that education knowledge is stored somewhere except RAM? can be dumped (think of object serialisation in a way) so that you don't need to educate your NN with data you get tomorrow or later.

Now I am trying to make simple demo with my dataset using synaptic.js but I could not spot that kind of concept of saving education in project's wiki. That library is just an example, if you reference some python lib would be good to!

like image 546
shershen Avatar asked Feb 24 '16 22:02

shershen


2 Answers

With regards to storing it via synaptic.js:

This is quite easy to do! It actually has a built-in function for this. There are two ways to do this.

If you want to use the network without training it again

This will create a standalone function of your network, you can use it anywhere with javascript without requiring synaptic.js! Wiki

var standalone = myNetwork.standalone();

If you want to modify the network later on

Just convert your network to a JSON. This can be loaded up anytime again with synaptic.js! Wiki

// Export the network to a JSON which you can save as plain text
var exported = myNetwork.toJSON();

// Conver the network back to useable network
var imported = Network.fromJSON(exported);
like image 161
Thomas Wagenaar Avatar answered Oct 19 '22 02:10

Thomas Wagenaar


I will assume in my answer that you are working with a simple multi-layer perceptron (MLP), although my answer is applicable to other networks too.

The purpose of 'training' an MLP is to find the correct synaptic weights that minimise the error on the network output.

When a neuron is connected to another neuron, its input is given a weight. The neuron performs a function, such as the weighted sum of all inputs, and then outputs the result.

Once you have trained your network, and found these weights, you can verify the results using a validation set.

If you are happy that your network is performing well, you simply record the weights that you applied to each connection. You can store these weights wherever you like (along with a description of the network structure) and then retrieve them later. There is no need to re-train the network every time you would like to use it.

Hope this helps.

like image 23
Kieran Avatar answered Oct 19 '22 02:10

Kieran