|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcc.glsn.v15.neuralnet.Brain
public class Brain
This class acts as a container for an artificial feed-forward neural network.
Supportes any number of inputs, any number of hidden layers of any size and any
number of outputs. The inputs and outputs are identified with a string identifier
so the user doesn't have to worry about indexing. Also, inputs and outputs may be added
at any time, so not all inputs and outputs need to be known initialy.
Each input connects to each neuron on the first hidden layer is using the default
input mapping of 'Full'. Each hidden layer is fully connected to the next hidden
layer. Each neuron on the last hidden layer connects to the output neuron.
It is serializable, as are all the contained classes. Thus its state
can be saved to files, databases, etc.
Brain(NetFunction, LinkedList, String),
Brain(NetFunction, LinkedList),
Serialized Form| Constructor Summary | |
|---|---|
Brain(NetFunction functg,
LinkedList<Integer> layerSizes)
Uses the default Input mapping style of 'Full'. |
|
Brain(NetFunction functg,
LinkedList<Integer> layerSizes,
String inputMappingStyle)
|
|
| Method Summary | |
|---|---|
void |
addInput(String name)
Add a new input of the given name. |
void |
addInputGroup(Collection<String> names)
Add a group if inputs at once. |
void |
addOutput(String name)
Add an output with the given name. |
void |
backPropogate(double alpha,
Map<String,Double> targets)
Do back propogation on a group of output targets at once. |
void |
backPropogate(String name,
double alpha,
double target)
Do back propogation learning with the given alpha and target. |
Map<String,Double> |
getAllOutputs()
Get the output values for all output neurons in a map |
Input |
getInputNode(String name)
So that inputs can be set directly to avoid the Map lookup that happens when setInput is used. |
double |
getOutput(String name)
Get the output from the single output neuron. |
void |
incSerial()
Manually increment the serial number. |
void |
removeOutput(String name)
Remove the output with the given name, if it exists |
void |
setAllInput(double val)
Set all inputs to the given value. |
void |
setHiddenLayers(LinkedList<Integer> layerSizes)
Resets the hidden layer sizes |
void |
setInput(String name,
double val)
Sets the value of the given input to 'val' |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Brain(NetFunction functg,
LinkedList<Integer> layerSizes)
functg - The function used inside neuronslayerSizes - a list of hidden layer sizesBrain(NetFunction, LinkedList, String)
public Brain(NetFunction functg,
LinkedList<Integer> layerSizes,
String inputMappingStyle)
functg - The function used inside neuronslayerSizes - a list of hidden layer sizesinputMappingStyle - Controls how the input layer is connected to the first hidden layer.
| Method Detail |
|---|
public void setHiddenLayers(LinkedList<Integer> layerSizes)
layerSizes - - new sizes. The first element of the linked list will
be the layer closest to the input. The last element will be the layer closest to
the output layer.
public void addInput(String name)
name - addInputGroup(Collection)public void addInputGroup(Collection<String> names)
names - addInput(String)public void addOutput(String name)
name - public void removeOutput(String name)
name -
public void setInput(String name,
double val)
name - val - public Input getInputNode(String name)
name - name of input to get
incSerial(),
setInput(String, double)public void incSerial()
getInputNode(String)public void setAllInput(double val)
val - - value to set inputs topublic double getOutput(String name)
public Map<String,Double> getAllOutputs()
public void backPropogate(String name,
double alpha,
double target)
name - - Output name to learnalpha - - The learning factor. Should be positive and less than one. 0.01 is a good starting point.target - - What the output value should be for the set inputs
public void backPropogate(double alpha,
Map<String,Double> targets)
alpha - - learning factor. Should be positive and less than one. 0.01 is a good starting point.targets - a map of string(output names) to doubles (target output values) to learn onpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||