Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a simple Neural Network to work from scratch in C++

I have been trying to get a simple double XOR neural network to work and I am having problems getting backpropagation to train a really simple feed forward neural network.
I have been mostly been trying to follow this guide in getting a neural network but have at best made programs that learn at extremely slow rate.

As I understand neural networks:

  1. Values are computed by taking the result of a sigmoid function from the sum of all inputs to that neuron. This is then fed to the next layer using the weight for each neuron
  2. At the end of running the error is computed for the output neurons, then using the weights, error is back propagated back by simply multiplying the values and then summing at each Neuron
  3. When all of the errors are computed the weights are adjusted by the delta = weight of connection * derivative of the sigmoid (value of Neuron weight is going to) * value of Neuron that connection is to * error of neuron * amount of output error of neuron going to * beta (some constant for learning rate)

This is my current muck of code that I am trying to get working. I have a lot of other attempts somewhat mixed in, but the main backpropagation function that I am trying to get working is on line 293 in Net.cpp

like image 982
Matthew FL Avatar asked Jan 07 '10 08:01

Matthew FL


People also ask

Can you build neural network without using any library?

Nowadays, Neural Network (NN) is a very powerful model and can be applied to various applications. This article provides a step-by-step tutorial for implementing NN, Forward Propagation and Backward propagation without any library such as tensorflow or keras. We have discussed the concept of NN in week4 and week 5.

What is neural network from scratch?

"Neural Networks From Scratch" is a book intended to teach you how to build neural networks on your own, without any libraries, so you can better understand deep learning and how all of the elements work.


1 Answers

Have a look at 15 Steps to implement a Neural Network, it should get you started.

like image 178
Gregory Pakosz Avatar answered Sep 22 '22 03:09

Gregory Pakosz