public class Brain extends Object implements Serializable
Constructor and Description |
---|
Brain(NetFunction functg,
LinkedList<Integer> layerSizes)
Uses the default Input mapping style of 'Full'.
|
Brain(NetFunction functg,
LinkedList<Integer> layerSizes,
String inputMappingStyle) |
Modifier and Type | Method and Description |
---|---|
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.
|
static long |
getInternalLinkCount(LinkedList<Integer> layerSizes)
Get the number of internal links for a given list of layer sizes
|
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() |
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.
public static long getInternalLinkCount(LinkedList<Integer> layerSizes)
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 getincSerial()
,
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 inputspublic 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 on