Use Teammaker to form your team. You can log in to that site to indicate your partner preference. Once you and your partner have specified each other, a GitHub repository will be created for your team.
There are many good sofware packages that you can use to experiment with neural networks, such as tensorflow, keras, or aitk. However, before using these packages you should first understand how backpropagation works at a detailed level. Therefore, in this lab you will implement your own neural network from scratch.
Your neural network will be made up of a number of classes:
As you are working on your implementation, you should frequently try the provided unit tests:
python3 nn_test.pyThere are 16 unit tests in this file. At the very top of the output that is produced, are 16 characters summarizing your progress. An E indicates a runtime error, a F indicates a failure, and a . indicates a success.
Below is a short summary of the tasks you need to complete. Note that much more detail about all of these methods can be found in the comments within the file neural_net.py.
Initially you will focus on implementing the SigmoidNode class methods:
The first three functions store their results in the node's self.activation and self.delta fields. update_weights changes the weights of the edges stored in self.in_edges.
Next you will work on completing the Network class. It is already set up to initialize a neural network with input, bias, and sigmoid nodes. You must implement the following functions for the neural network:
The main function sets up a network with a single two-neuron hidden layer and trains it to represent the function XOR.
Once you can successfully learn XOR, move on to the next section.
In the latex document provided (called explanation.tex), fill in the diagram of the XOR network with the specific weights that were found by your program. Then explain how your network has solved the XOR problem. In particular, you need to clearly articulate:
To compile your latex document into a pdf, run the following command:
pdflatex explanation.texOr if you prefer, a Makefile has also been provided. Once compiled, you can then open the pdf from the command line with the command:
evince explanation.pdf
Be sure to include your name(s) in the title of the document.
You should submit the files neural_net.py and explanation.tex. As usual, use git to add, commit, and push your work.