Represent a Basic Neural Network with three layers.
This deals with a Neural Network containing three layers:
Input Layer
Hidden Layer
Output Layer
Methods
|
|
__init__
predict
train
|
|
__init__
|
__init__ (
self,
input_layer,
hidden_layer,
output_layer,
)
Initialize the network with the three layers.
|
|
predict
|
predict ( self, inputs )
Predict outputs from the neural network with the given inputs.
This uses the current neural network to predict outputs, no
training of the neural network is done here.
|
|
train
|
train (
self,
training_examples,
validation_examples,
stopping_criteria,
learning_rate,
momentum,
)
Train the neural network to recognize particular examples.
Arguments:
training_examples -- A list of TrainingExample classes that will
be used to train the network.
validation_examples -- A list of TrainingExample classes that
are used to validate the network as it is trained. These examples
are not used to train so the provide an independent method of
checking how the training is doing. Normally, when the error
from these examples starts to rise, then it's time to stop
training.
stopping_criteria -- A function, that when passed the number of
iterations, the training error, and the validation error, will
determine when to stop learning.
learning_rate -- The learning rate of the neural network.
momentum -- The momentum of the NN, which describes how much
of the prevoious weight change to use.
|
|