I was reading an article for Neural Networks from the below URL, and I was checking the example.
but I can't understand the Line No 7 in the example which says
self.weights = 2 * random.random((2, 1)) - 1
How this formula derived for adding random weight?
I mean does this formula will always same for any mathematic operation, if not how we can derive formula?
That's just how the weights are initialized.
x * numpy.random.random((y, z))
Create a 2 dimensional array of pseudo random numbers between 0 and 1 with y rows * z columns and multiply each number in the array with x.
Anna yh I got that, but I want to know how this formula derived.
I mean if I want to create a code for square of a number similar as above example this formula won't work.
so for me, how this things are working is more important, what would be the formula for square of number.
Matthias I would be interested to know the reason why the neural network is not able to learn the weights for (a+b)^2 exactly although it is provided perfect training data... just like for (a+b)*2?
Would a code update work?
Would you require more training data?
Should the network structure be more complex?
Thanks for any input if you read this still 👍
Pe Kie Unfortunately I can't explain it well, I only know very bit of machine learning 🙈
There was a comment of another user explaining it quite well, but it seems it got deleted :/
What it was basically saying is, that the structure of used network corresponds to linear functions. For quadratic function we need a different network.
Something like this.
But take it with care, I know nothing xD