I have been working on the first two parts of your "Neural Networks" Series for a few weeks now, and I keep comming accros the following code below when cycling through Neurons (or other things).
I really don't get it - in my view this would always leave out the last element. The Total() functions should return a count, then your remove one AND use "<" in the for loop. So for a Total() count of 2, you would only run the for loop once.
but assume we have 20 neurons in the layer, and we assign total variable with 19 [int total=Layer.Total()-1] so now total is equal to 19 , when we iterating over neurons from index 0-18 (total=19) we never reach the index 19 (last neuron), I think we must change the code with:
in some piece of codes you have written something like:
but assume we have 20 neurons in the layer, and we assign total variable with 19 [int total=Layer.Total()-1] so now total is equal to 19 , when we iterating over neurons from index 0-18 (total=19) we never reach the index 19 (last neuron), I think we must change the code with:
or
to reach the last neuron on the layer.
what is you idea?
At every layer we add one more neuron for bayesian shift. So at calling function to create layer with 20 neurons we creating 21 neurons. And Layer.Total() will return 21. But input data will has only 20 elements. Last bayesian neuron always have '1' in output. So I use Layer.Total()-1. In loop I use "<" because first element of the array has index '0'.
Hello, first time learning neural network, your article is very suitable for me, but I want to know why -1 is needed in many places, such as: nextLayer.Total () - 1, so that it does not match the number of neurons in the next layer .
Hello, first time learning neural network, your article is very suitable for me, but I want to know why -1 is needed in many places, such as: nextLayer. () - 1, so that it does not match the number of neurons in the next layer .
Hi, it's normal work with array. At mql5 all array index start form 0. And nextLayer.Total() return total number of neurons. So if it back 10 that means elements of array have indexes from 0 to 9.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi Dmitriy,
I have been working on the first two parts of your "Neural Networks" Series for a few weeks now, and I keep comming accros the following code below when cycling through Neurons (or other things).
I really don't get it - in my view this would always leave out the last element. The Total() functions should return a count, then your remove one AND use "<" in the for loop. So for a Total() count of 2, you would only run the for loop once.
What am I missing?
Regards,
Delf
in some piece of codes you have written something like:
but assume we have 20 neurons in the layer, and we assign total variable with 19 [int total=Layer.Total()-1] so now total is equal to 19 , when we iterating over neurons from index 0-18 (total=19) we never reach the index 19 (last neuron), I think we must change the code with:
or
to reach the last neuron on the layer.
what is you idea?
in some piece of codes you have written something like:
but assume we have 20 neurons in the layer, and we assign total variable with 19 [int total=Layer.Total()-1] so now total is equal to 19 , when we iterating over neurons from index 0-18 (total=19) we never reach the index 19 (last neuron), I think we must change the code with:
or
to reach the last neuron on the layer.
what is you idea?
At every layer we add one more neuron for bayesian shift. So at calling function to create layer with 20 neurons we creating 21 neurons. And Layer.Total() will return 21. But input data will has only 20 elements. Last bayesian neuron always have '1' in output. So I use Layer.Total()-1. In loop I use "<" because first element of the array has index '0'.
New Article Neural Networks Made Easy has been released:
Written by Dmitriy Gizlyk
Hello, first time learning neural network, your article is very suitable for me, but I want to know why -1 is needed in many places, such as: nextLayer.Total () - 1, so that it does not match the number of neurons in the next layer .
Hello, first time learning neural network, your article is very suitable for me, but I want to know why -1 is needed in many places, such as: nextLayer. () - 1, so that it does not match the number of neurons in the next layer .
Hi, it's normal work with array. At mql5 all array index start form 0. And nextLayer.Total() return total number of neurons. So if it back 10 that means elements of array have indexes from 0 to 9.
I actually get an compilation error when downloaded the file.
Try to use GetPointer function.
Hi Dmitriy, Thank for this article. Please for this error, how can one fix it? could you please provide the corrected code?
Hi Muhammad, did you get to fix this error?