Page 1 of 1

How to save and load weight

PostPosted: Thu Apr 28, 2011 7:28 pm
by rads
Hello there,

I want to ask how to save the weight which is already trained,
and the next time application is up, we can use the weight that already trained?

according to http://www.aforgenet.com/framework/docs ... 5906fb.htm

I thought I could use, network.save(string) but it can't?

Re: How to save and load weight

PostPosted: Thu Apr 28, 2011 7:45 pm
by andrew.kirillov
Hello,

rads wrote:I thought I could use, network.save(string) but it can't?

Very interesting. Please, explain why?

Anyway. You will need to use that Save() method.

Re: How to save and load weight

PostPosted: Fri Apr 29, 2011 8:09 am
by rads
sorry, I wrong, I used the old library so network.save() isn't work.

can I ask a few question?
1. what actually network.save() is save? It is save the all info about alpha, input, and so on?
2. how can I save the weight of each neuron and load it for next time use?
from what I know how to access the weight is network[layer][neuron][weight]? is it wrong or correct?

3. I use sigmoid activation, which is mean, range of the output is between 0 to 1, but the output i get is sometimes more than 1, any suggestion why?

thanks alot man..

Re: How to save and load weight

PostPosted: Fri Apr 29, 2011 8:22 am
by andrew.kirillov
Save() does serialization of Network class. It saves all that belong to network - weights, sigmoid’s alpha, etc. But it has nothing to do with inputs, outputs, learning rate, etc. - these all are not part of network.

Re: How to save and load weight

PostPosted: Fri Apr 29, 2011 8:30 am
by rads
thanks,

so when I save, in .txt it's still fine right? and if we want to use previous weight,then all we need is load the saved network?

oh and, my weight, i thought AForge set the default random weight range [0,1] but when i access it network[0][0][0] the weight is 3 or 6..how can that be?

Re: How to save and load weight

PostPosted: Fri Apr 29, 2011 10:21 am
by andrew.kirillov
rads wrote:so when I save, in .txt it's still fine right? and if we want to use previous weight,then all we need is load the saved network?

Just try it. It will take 5 minutes max.

rads wrote:but when i access it network[0][0][0] the weight is 3 or 6..how can that be?

Network is supposed to learn and change its weights. Is not it?

Re: How to save and load weight

PostPosted: Fri Apr 29, 2011 1:21 pm
by rads
yes, the network supposed to learn. but, your defaul weight range is [0,1], what i get is, -3 or 3 or 6 and so on. more than zero and one.

any suggestion? if use, your sample application and access weight, the weight is right between 0 and 1.