Neural Networks in Python

From CCN Wiki
Revision as of 11:44, 8 March 2019 by Chris (talk | contribs)
Jump to navigation Jump to search

Before You Begin

We've been using the Keras API with the TensorFlow backend for our simulations. Our code often also uses the numPy and SciKit libraries because I often steal code examples that happen to have been coded using those libraries. When you get started, you will want to make sure that all the requisite libraries are installed. Pip (the Python package installer) has a function called freeze that will list all your installed libraries. This list can be dumped to a text file and used to share the list of Python packages you'll need to run any of the code we've developed:

pip freeze > requirements.txt

Now any lab member can use requirements.txt to ensure they have the requisite Python packages installed:

pip install -r requirements.txt

I've got the current list of dependencies on ubfs/Scripts/Python/requirements.txt

A Simple Feedforward Classifier Network

Keras has defined network templates, but the only one that I've seen well-documented is the 'forward model. Fortunately, the forward model is well-suited to the classification task: it takes a set of input values, feeds the values forward over a set of layers, and checks the output values in a set of binary classification units. If the output decision is strictly binary (A vs B), then one output unit will suffice (since it's a zero-sum decision). If 3+ output categories are possible, then there needs to be an output unit for each possible category.