Click here to Skip to main content
15,880,608 members
Home / Discussions / C#
   

C#

 
AnswerRe: RE: Save user's re-order grid preferences Pin
Mycroft Holmes9-Oct-10 2:31
professionalMycroft Holmes9-Oct-10 2:31 
GeneralRe: RE: Save user's re-order grid preferences Pin
roman_s12-Oct-10 7:19
roman_s12-Oct-10 7:19 
GeneralRe: RE: Save user's re-order grid preferences Pin
Mycroft Holmes12-Oct-10 12:50
professionalMycroft Holmes12-Oct-10 12:50 
Questioni write a backprobagate neural network code with c# and it is work slowly [modified] Pin
karayel_kara8-Oct-10 5:06
karayel_kara8-Oct-10 5:06 
AnswerRe: i write a backprobagate neural network code with c# and it is work slowly Pin
Not Active8-Oct-10 5:23
mentorNot Active8-Oct-10 5:23 
GeneralRe: i write a backprobagate neural network code with c# and it is work slowly Pin
Khaniya8-Oct-10 21:07
professionalKhaniya8-Oct-10 21:07 
AnswerRe: i write a backprobagate neural network code with c# and it is work slowly Pin
Abhinav S8-Oct-10 22:43
Abhinav S8-Oct-10 22:43 
AnswerRe: i write a backprobagate neural network code with c# and it is work slowly [modified] Pin
Keith Barrow9-Oct-10 7:41
professionalKeith Barrow9-Oct-10 7:41 
Are you still stuggling with this Smile | :) !

Please format your code, as you can see it is dificult to read and you are being down voted.

Point one: Nested loops = poor performance [generally].

Your class structure is wrongly IMO. Each Neuron should have a List<Dendrite> for both input and output. A Dendrite should have both an input and output Neuron as well as any weighting. You might need to put deltas in there too, I can't remember. There needs to be a special subclass for the Input Layer and Output layer as these don't have Input Neurons and Output Neurons respectively.

Set the activation inputs, and calculate the activations on each layer in succession. The calculation is easy:
//Pseudocode - in Neuron
InputAcivation = 0.0;
ForEach(Dendrite dendrite in InputDendrites)
   InputAcivation += dendrite.Activation;
Activation = Squash(InputActivation); // Where Squash is the Squashing function to put into range 0-->1 -1 -->1 or whatever 

Note that I have the Dendrite class calculaing the Activation from the input, "Weight * InputActivation".

The backprop works in a similar way (but reverse!) the desired output is placed onto a property on the output layer, and then each layered is worked back to the input. I really can't remember the ins and outs of this, but you only really need to loop over each neuron in each layer to do this, plus the dendrites.

One advantage of generic Lists over arrays (if you are having a speed problem) is that you can trim "dead" connections (ones whose weights are near zero and have little momentum over multiple tries. Another suggestion is to try to define Halting Criteria, which defines when the NNW is getting it right enough to stop learning. You can over-train a NNW.

One final thing, the OO encapsulation is poor IMO, the calculation code (as I have suggested above) should be in the Neurons, not the main code block. This goes for the backprop calcs too. If you do this, you won't have so many array calls confusing the mix, and you'll be able to profile your app a little better.

[Edit]
My class structure probably isn't the best, I last wrote a NNW ~10 years ago as an undergrad, in c++, but hopefully you'll get the idea. Did you check out the NNW article on CP I mentioned in your previous thread?
Sort of a cross between Lawrence of Arabia and Dilbert.[^]
modified on Saturday, October 9, 2010 2:06 PM

AnswerRe: i write a backprobagate neural network code with c# and it is work slowly Pin
karayel_kara10-Oct-10 23:13
karayel_kara10-Oct-10 23:13 
QuestionCustom TextSource creates TextRuns more than once Pin
WebMaster8-Oct-10 4:47
WebMaster8-Oct-10 4:47 
AnswerRe: Custom TextSource creates TextRuns more than once Pin
OriginalGriff8-Oct-10 5:26
mveOriginalGriff8-Oct-10 5:26 
QuestionDos Command Pin
M Riaz Bashir8-Oct-10 2:31
M Riaz Bashir8-Oct-10 2:31 
AnswerRe: Dos Command Pin
#realJSOP8-Oct-10 2:34
mve#realJSOP8-Oct-10 2:34 
GeneralRe: Dos Command Pin
M Riaz Bashir8-Oct-10 2:37
M Riaz Bashir8-Oct-10 2:37 
AnswerRe: Dos Command Pin
Pete O'Hanlon8-Oct-10 2:37
mvePete O'Hanlon8-Oct-10 2:37 
AnswerRe: Dos Command Pin
MasttsaM13-Oct-10 22:04
MasttsaM13-Oct-10 22:04 
QuestionPassing Objects From Child Form Back To User Control Pin
JasonD_S7-Oct-10 22:54
JasonD_S7-Oct-10 22:54 
AnswerRe: Passing Objects From Child Form Back To User Control Pin
OriginalGriff7-Oct-10 23:11
mveOriginalGriff7-Oct-10 23:11 
GeneralRe: Passing Objects From Child Form Back To User Control Pin
JasonD_S8-Oct-10 1:25
JasonD_S8-Oct-10 1:25 
GeneralRe: Passing Objects From Child Form Back To User Control Pin
OriginalGriff8-Oct-10 1:26
mveOriginalGriff8-Oct-10 1:26 
GeneralRe: Passing Objects From Child Form Back To User Control Pin
JasonD_S8-Oct-10 1:31
JasonD_S8-Oct-10 1:31 
GeneralRe: Passing Objects From Child Form Back To User Control Pin
OriginalGriff8-Oct-10 1:47
mveOriginalGriff8-Oct-10 1:47 
AnswerRe: Passing Objects From Child Form Back To User Control Pin
#realJSOP8-Oct-10 2:32
mve#realJSOP8-Oct-10 2:32 
QuestionToolbar editing example code please. Pin
Jung Sung Uk7-Oct-10 21:00
Jung Sung Uk7-Oct-10 21:00 
QuestionUnit Test a database update code? Pin
Shubhabrata Mohanty7-Oct-10 20:42
Shubhabrata Mohanty7-Oct-10 20:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.