How to build a simple neural network in 9 lines of Python code

Diagram 1
Diagram 2
  1. Calculate the error, which is the difference between the neuron’s output and the desired output in the training set example.
  2. Depending on the direction of the error, adjust the weights slightly.
  3. Repeat this process 10, 000 times.
Diagram 3
Diagram 4
  1. If the output is a large positive or negative number, it signifies the neuron was quite confident one way or another.
  2. From Diagram 4, we can see that at large numbers, the Sigmoid curve has a shallow gradient.
  3. If the neuron is confident that the existing weight is correct, it doesn’t want to adjust it very much. Multiplying by the Sigmoid curve gradient achieves this.
  • array — creates a matrix
  • dot — multiplies matrices
  • random — gives us random numbers

Technology, Invention, App, and More

Technology trends and New Invention? Follow this collection to update the latest trend! [UPDATE] As a collection editor, I don’t have any permission to add your articles in the wild. Please submit your article and I will approve. Also, follow this collection, please.

Milo Spencer-Harper

Written by

Studied Economics at Oxford University. Founder of www.moju.io. Interested in politics and AI.

Technology, Invention, App, and More

Technology trends and New Invention? Follow this collection to update the latest trend! [UPDATE] As a collection editor, I don’t have any permission to add your articles in the wild. Please submit your article and I will approve. Also, follow this collection, please.