FeedForward Neural Network in Python
Created at 2017-05-18 Updated at 2017-05-18
Get the code hereI developed a simple Feedforward neural network class implemented in python with a command line tool, which might help getting to know how to use the NN class:
Example usage (XOR function):
|
|
Where the FNN has 2 inputs, 4 neurons in one hidden layer and 1 output. -t means to train the following dataset (file or given string-array), -p means to predict the following values (file or values), -e the number of epochs, -s to save the model with the filename ‘model.nn’, -a to set the activation function of hidden layers as tanh and -o to set the activation function of the output layer as sigmoid.
Note: -n [2,4,4,1] would mean to use 2 hidden layers with 4 neurons each.
Note 2: for some activation functions, there could be overflows… this is solved by adjusting the learning rate and/or regularization factor. Usually reducing it, e.g. 0.1 –> 0.01
Outputs:
|
|