network.py
is a simple neural network class that trains via single sample mini batch stochastic gradient descent.
- the network class requires either a local or a global instance of numpy, the popular python data processing library
- the class is initialized with three parameters to the constructor:
- a python list containing the number of nodes in the first, second and third layers eg.
[72, 20, 5]
- a floating point learning rate
- a floating point momentum rate (set to 0 to negate the effects of the momentum term)
- a python list containing the number of nodes in the first, second and third layers eg.
- the class's member functions should be fairly self explanatory, however it is worth mentioning that the
backprop()
function does not loop until an error limit is reached, this is instead done by the calling program as the error term is the return value of thebackprop()
function.
digit_recog.py
is a simple class that contains methods for the initialization of training data and simple demonstrations of the neural network's potential.