AForge.NET

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

Using learnt Neural Network (setting weights and thresholds)

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

Using learnt Neural Network (setting weights and thresholds)

Postby fernandarp » Thu Jul 16, 2015 11:31 am

Hi all,

Here is my idea: I want to train a NeuralNetwork with BackPropagation learning (like in "TimeSeries" or "Approximation" examples) and extract the weights and thresholds to use when I run the program again. The problem is that I don't know how and where to set the weights and thresholds.

Also, I wanted to compare the result with the Matlab, using the weights and thresholds (bias) there to see if the result is good. Can this be done?

I'd appreciate any help, thanks.
fernandarp
 
Posts: 5
Joined: Wed Jul 15, 2015 12:50 pm

Re: Using learnt Neural Network (setting weights and thresho

Postby andrew.kirillov » Thu Jul 16, 2015 12:16 pm

Hello,

See this topic, which says how to access weights.
With best regards,
Andrew


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

Re: Using learnt Neural Network (setting weights and thresho

Postby fernandarp » Thu Jul 16, 2015 12:30 pm

Thank you!

How about the thresholds?
fernandarp
 
Posts: 5
Joined: Wed Jul 15, 2015 12:50 pm

Re: Using learnt Neural Network (setting weights and thresho

Postby andrew.kirillov » Thu Jul 16, 2015 12:44 pm

Well, there is documentation for this - ActivationNeuron.Threshold.
With best regards,
Andrew


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

Re: Using learnt Neural Network (setting weights and thresho

Postby fernandarp » Thu Jul 16, 2015 2:00 pm

I saw that, but here is the problem: in the Matlab, for example, the threshold is associated to each layer and each neuron. But, I don't know how to set like this in the Aforge, similar to how I did with the weights. Something like this:

threshold[0] = new double[4] { 0, 0, 0, 0 };
threshold[1] = new double[2] { 0, 0 };
threshold[2] = new double[1] { 0 };

3 layers, 4 neurons in the first layer, 2 neuros in the second and 1 in the last one.
fernandarp
 
Posts: 5
Joined: Wed Jul 15, 2015 12:50 pm

Re: Using learnt Neural Network (setting weights and thresho

Postby andrew.kirillov » Thu Jul 16, 2015 2:10 pm

fernandarp wrote:in the Matlab, for example, the threshold is associated to each layer and each neuron

Similar in AForge.NET Framework as well - each neuron has its own threshold.

fernandarp wrote:threshold[0] = new double[4] { 0, 0, 0, 0 };
threshold[1] = new double[2] { 0, 0 };
threshold[2] = new double[1] { 0 };

Not sure what the above means - does not make sense to me.
With best regards,
Andrew


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

Re: Using learnt Neural Network (setting weights and thresho

Postby fernandarp » Thu Jul 16, 2015 2:23 pm

Forget about the example, it was just to illustrate the setting, it was not part of the actual code. I think I was clear hahaha

But I still don't know how to acess to each Neuron. With weights, it's like: network.Layers[0].Neurons[0].Weights[0]. How about the thresholds? It is in the ActivationNeuron, right? Should I have an object and access it, or what? Sorry for my newbiness.

Thank you for all your help.
fernandarp
 
Posts: 5
Joined: Wed Jul 15, 2015 12:50 pm




Return to Artificial Intelligence