The Math Behind the Neural Network

Last week I gave a brief introduction to neural networks, but left out most of the math. It turns out that, like genetic algorithms, neural nets have extremely awesome mathematical properties which allow computer programmers to create efficient and effective neural programs.

Remember how each neural takes in charge, figures out if it is higher than a certain threshold, and then sends out charge to other neurons? Well, it turns out that this can be easily represented as an equation.

In the simplest case you have one neuron with a singe neuron before it, and a single neuron after it. The neuron has a singe value, say T, which represents its threshold. If the charge coming into the neuron, say C, is larger than T, {if(C > Y)}, then it will fire. C, in this case, is simply the charge from the one neuron before this one.

Okay, so we have the math logic, {if(C > Y) fire!}. This neuron now gives off charge to the next one down the line. We call this amount of charge the weight of the connection, W. A higher weight is how much of the neuron's charge goes to the next neuron. If a pulse has 1 charge, then the next neuron gets W * 1 = W charge.

The great thing about this simple mathematical model is that it is easy to expand. Consider the following setup, 2 neurons → 1 neuron → 2 neurons.

Here, C for the middle neuron is {C = Winput1 + Winput2}, and if C is > Y, it will fire an amount Woutput1 and Woutput2. Simple. Easy. Efficient.

Now consider 2 → 3 → 2. The middle layer (the 3 neurons) C values can be set up as follows:

F1*W1,1 + F2*W2,1 = C1

F1*W1,2 + F2*W2,2 = C2

F1*W1,3 + F2*W2,3 = C3

F is 0 or 1, depending on whether the previous neuron fired or not. W n,m is the weight of the previous neuron n to the next neuron m.

For those sharper mathematical fellows, this is a very simple set of linear equations. This simply means the equation forms a straight line, and because of its straightforward linear properties, can be easily converted into a set of matrix equations. The previous example reduces to the following matrix equation:

[W11    W21]    [F1]    [C1]

[W12    W22] * [F2] = [C2]

[W13    W23]    [F3]    [C3]

The first matrix is called the Weight Matrix, the second I call the Pulse Matrix, and the last is the Charge Matrix. The Weight Matrix contains the information of how strong the charge connections between neuron layers are, the Pulse Matrix is whether or not the neurons in that layer are firing, and the Charge Matrix is the sum of the charges on the next layer. All you need to do with the Charge Matrix is see if it is bigger than the threshold for the neurons it represents to get the next Fire Matrix.

Using this math you can reduce a very complicated neural network into a streamlined set of matrix equations. Instead of evolving a set of neuron objects, you can adjust the contents of each layer's weight matrix and threshold matrix, and presto, you get an evolved creation. The following is a demonstration video for a juiced up version of my last program, now using matrix math.  (Note: the creatures now are more like tanks, with a left tread and a right tread.  They adjust their motion by adjusting the speed of each tread.  Hence the tight turns.)

The code for my upgraded matrix math neural net can be found here.

200 thoughts on “The Math Behind the Neural Network

  1. Pingback: read article AGH

  2. Pingback:

  3. Pingback: follow this post e2QDJN

  4. Pingback: view more HVC

  5. Pingback: click here

  6. Pingback:

  7. Pingback: article source qpqDGn

  8. Pingback:

  9. Pingback:

  10. Pingback:

  11. Pingback:

  12. Pingback: continued here R2w8

  13. Pingback: visit the source

  14. Pingback: link to a continuation

  15. Pingback:

  16. Pingback:

  17. Pingback: continued here

  18. Pingback: click for details

  19. Pingback: click to to learn more

  20. Pingback: click at this page

  21. Pingback: click to to learn more pF5

  22. Pingback: i'll provide a link T9aA

  23. Pingback: Trully Independent Bangalore Escorts Services

  24. Pingback: Sruthi Pathak Bangalore Escorts Services

  25. Pingback: buy cialis medication

  26. Pingback: download912 afeu23na8227 abdu23na16

  27. Pingback: fknjn544a33 afeu23na7843 abdu23na92

  28. Pingback: tubepla67 afeu23na9286 abdu23na21

  29. Pingback: newtube tube planet811 afeu23na755 abdu23na45

  30. Pingback: fknjn544a434 afeu23na376 abdu23na36

  31. Pingback: click at this page

  32. Pingback: freshamateurs293 abdu23na7860 abdu23na97

  33. Pingback: freshamateurs694 abdu23na5094 abdu23na40

  34. Pingback: new siriustube451 abdu23na4145 abdu23na81

  35. Pingback: latestvideo sirius806 abdu23na560 abdu23na88

  36. Pingback: freshamateurs501 abdu23na020 abdu23na76

  37. Pingback: new siriustube699 abdu23na4330 abdu23na87

  38. Pingback: Sruthi Pathak Bangalore Female Escorts

  39. Pingback: go to the source

  40. Pingback:

  41. Pingback: comment713

  42. Pingback: comment882

  43. Pingback: comment573

  44. Pingback: comment74

  45. Pingback: comment600

  46. Pingback: comment261

  47. Pingback: comment651

  48. Pingback: comment975

  49. Pingback: comment901

  50. Pingback: comment49

Leave a Reply