I want to create my own neural network but I'm not grasping the concept of how the neural network gets trained/gets to an output.

Say you have the following example: link to example

As you can see in the var trainingdata there is exact data on what you want the neural network (hamster) to output.

If the machine finishes training that data, why is it that if you input:

[0, 1]

it returns:

Sit Neuron: 0.014995911436294706% Run Neuron: 99.39201708556335% Jump Neuron: 1.2615268528823826%

To my understanding it should return the following:

Sit Neuron: 0% Run Neuron: 100% Jump Neuron: 0%

Because the machine can literally compare the input [0, 1] with the trainingdata, which contains the exact output.

Why is it that the machine still considers the jump and sit to be valid?

  • $\begingroup$ Questions specific to how Javascript works is off topic here. $\endgroup$ May 11, 2017 at 15:56
  • $\begingroup$ @MichaelChernick I may say this question is on topic but almost impossible to answer. $\endgroup$
    – Haitao Du
    May 11, 2017 at 16:09
  • $\begingroup$ It is hard to answer since too much background information is needed. It is not a popular library / software implementation, and not a popular data set. The question is not general for other people's interest. $\endgroup$
    – Haitao Du
    May 11, 2017 at 16:11
  • $\begingroup$ As you can see from the link this is done using Javascript. So I interpreted "the machine still considers the jump an sit to be valid" to refer to what the code is doing rather than something that is a property of a neural network. $\endgroup$ May 11, 2017 at 16:14

1 Answer 1


Because a neural network is not perfect. First of all, it will always 'approach' the goal through the gradient. Second of all, your network will squash the values it receives with an activation function. If that is sigmoid function, it will never hit 1 (in your case, 100%). It always approaches 1.

You also have to take the learning rate into account.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.