### text

parent 30e0d837
 ... ... @@ -11,16 +11,20 @@ crossorigin="anonymous"> Neural network visualized

Neural network visualized

Visualization of a simple neural network for strictly educational purposes.

... ... @@ -117,6 +121,9 @@
... ... @@ -131,9 +138,43 @@ Sorry, you need a better browser to see the neural net.

What is this?

Cost function

This is implementation of neural network with back-propagation. There aren't any special tricks, it's as simple neural network as it gets. The cost is defined as $$C = \frac{1}{2 \times sampleCnt}\sum^{sampleCnt}_{m=1}(\sum^{outputSize}_{n=1}(neruon_n-target_n)^2)$$. In words: Error is defined as $$(value - target)^2$$. To get error of neural network for one training sample, you simply add errors of all output neurons. The total cost is then defined as average error of all training samples.

Forward propagation

Let's say that the value of connection is the connection's weight (how wide it is) times the first connected neuron. To calculate the value of some neuron you add the values of all incoming connections and apply the sigmoid function the that sum. Other activation functions are possible, but I have not implemented them yet.

Back propagation

This is implementation of neural network with back-propagation. blablabla In the simplest way possible: The cost function defined above is a function dependend on weights of connections in the same way as $$f(x, y) = x^2 + y^2$$ is dependend on x and y. What you do is that you take derivation of C with respect to each of the weights. Each of these derivatives tells you in which direction (up/down) will the cost change if you increase/decrease the weight. So you take the old weight and substract a small step is a direction that decreases the cost. In equation: $$w_{new} = w_{old} - rate \times \frac{\partial C}{\partial w_{old}}$$. How to compute the derivative is a little bit harder, but all you need to know is the chain rule. I highly recommend 3blue1brown's series and this paper for better understanding.

Inpiration

I got inspired by the https://playground.tensorflow.org and https://cs.stanford.edu/people/karpathy/convnetjs/, but I wanted something simpler and build it myself from the ground up.

... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment