AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

How to save and load weight

The forum is to discuss topics from different artificial intelligence areas, like neural networks, genetic algorithms, machine learning, etc.

How to save and load weight

Postby rads » Thu Apr 28, 2011 7:28 pm

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?
rads
 
Posts: 10
Joined: Sat Apr 23, 2011 9:45 am

Re: How to save and load weight

Postby andrew.kirillov » Thu Apr 28, 2011 7:45 pm

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.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3450
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: How to save and load weight

Postby rads » Fri Apr 29, 2011 8:09 am

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..
rads
 
Posts: 10
Joined: Sat Apr 23, 2011 9:45 am

Re: How to save and load weight

Postby andrew.kirillov » Fri Apr 29, 2011 8:22 am

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.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3450
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: How to save and load weight

Postby rads » Fri Apr 29, 2011 8:30 am

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?
rads
 
Posts: 10
Joined: Sat Apr 23, 2011 9:45 am

Re: How to save and load weight

Postby andrew.kirillov » Fri Apr 29, 2011 10:21 am

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?
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3450
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: How to save and load weight

Postby rads » Fri Apr 29, 2011 1:21 pm

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.
rads
 
Posts: 10
Joined: Sat Apr 23, 2011 9:45 am




Return to Artificial Intelligence

cron