|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.penguinwerks.jodene.Network
This is a neural network. It is composed of neurons, some of which are input neurons, some of which are output neurons, and some are internal (hidden layer) neurons.
A network does not automatically connect neurons, except for the bias
neuron. When the network is created, the neurons are connected by
using the connect method.
Note that the neuron receives its input and produces its output as
a java.util.Map. The map is keyed on the name of the
input. The key in the input must match the name of the input neuron,
otherwise an exception is thrown. See the
com.penguinwerks.black.data package for utilities to
read in data as a named map.
| Constructor Summary | |
Network()
Create a new instance of a network. |
|
| Method Summary | |
void |
addInputNeuron(Neuron neuron)
Add input neuron. |
void |
addInternalNeuron(Neuron neuron)
Adds a "hidden layer" neuron. |
void |
addOutputNeuron(Neuron neuron)
Add output neuron. |
void |
adjustWeights()
Called during training to periodically adjust the weights on the network. |
void |
beginTraining(Trainer trainer)
Attaches a trainer to the network and establishes any necessary structures for training. |
void |
connect(Neuron base,
Neuron dendrite)
Connect two neurons. |
void |
connect(java.lang.String base,
java.lang.String dendrite)
Connect two nuerons by their name. |
void |
endTraining()
Completes the training by removing training structures from the network. |
ActivationFactory |
getActivationFactory()
Returns the activaiton factory. |
NeuronTraining |
getTrainer(java.lang.String neuronId)
Returns the trainer attached to this network. |
java.util.Map |
process(java.util.Map inputs)
Process a set of inputs and return a result. |
void |
setActivationFactory(ActivationFactory factory)
Set the activation factory which will create new activation functions. |
void |
setFeedback(java.util.Map actual,
java.util.Map expected)
During training a network is presented the actual and expected values for a given input. |
void |
updateAdjustments()
Updates the weight adjustments for all the neurons in the network. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Network()
| Method Detail |
public void setActivationFactory(ActivationFactory factory)
factory - The activation factory.public ActivationFactory getActivationFactory()
public void addOutputNeuron(Neuron neuron)
throws DuplicateNeuronException
neuron - The output neuron.
DuplicateNeuronException - Thrown if a neuron with the same name exists.
public void addInputNeuron(Neuron neuron)
throws DuplicateNeuronException
neuron - The new input neuron.
DuplicateNeuronException - Thrown if a neuron with the same name already exists.
public void addInternalNeuron(Neuron neuron)
throws DuplicateNeuronException
neuron - The new neuron to add
DuplicateNeuronException - Thrown if a neuron with the same name exists.
public void connect(java.lang.String base,
java.lang.String dendrite)
base - The name of the base neuron to connect.dendrite - The name of the dendrite neuron to connect.
public void connect(Neuron base,
Neuron dendrite)
base - A base neuron to connect.dendrite - A dendrite neuron to connect.
public java.util.Map process(java.util.Map inputs)
throws InvalidInputsException
InvalidInputsException
is thrown. It returns a map with the output values keyed on the names
of the output neurons.
inputs - The inputs to the network
InvalidInputsException - Thrown if the input names do not match the input neuron names.public NeuronTraining getTrainer(java.lang.String neuronId)
neuronId - Returns the neuron trainer for the named neuron.
public void setFeedback(java.util.Map actual,
java.util.Map expected)
actual - The actual values obtained from executing the network.expected - The expected values from a training example.public void beginTraining(Trainer trainer)
trainer - The trainer that will perform the training.public void endTraining()
public void adjustWeights()
public void updateAdjustments()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||