|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.htwdd.rosenkoenig.neuro.net.NeuralNet
de.htwdd.rosenkoenig.neuro.net.FeedForwardNet
public class FeedForwardNet
This class implements a feed forward net. The code and the functionality might be a little abstruse sometimes. This is to improve the performance of the net in 99% of the case and laziness of the one who implemented it in 1% of the cases.
| Field Summary | |
|---|---|
private static java.lang.Class[] |
CONSTRUCTOR_PARAMS
|
private boolean |
initialized
Determines the initialization state of the net. |
private InputLayer |
inputLayer
The input layer of the net. |
private java.util.ArrayList<InnerLayer> |
layers
This is the ArrayList representation of the hidden layers and the output layer. |
| Constructor Summary | |
|---|---|
FeedForwardNet()
Creates an empty FeedForwardNet (i.e. without any layers). |
|
FeedForwardNet(int inputLayerSize,
int outputLayerSize)
Creates a FeedForwardNet with inputLayerSize number of input layers and outputLayerSize number of output layers. |
|
| Method Summary | |
|---|---|
void |
addHiddenLayer(int layerSize,
ActivationFunction activationFunction)
Add a hidden layer of layerSize using activationFunction to your net. |
boolean |
addLayers(InnerLayer innerLayer)
Appends the specified layer to the end of this list (optional operation). |
void |
addLayers(int index,
InnerLayer innerLayer)
Inserts the specified layer at the specified position in this list (optional operation) |
void |
clearLayers()
Removes all of the layers from this list (optional operation). |
private void |
connectLayers()
This function takes this net and connects all layers. |
boolean |
containsAllLayers(java.util.Collection<InnerLayer> layers)
Returns true if this list contains all of the layers of the specified collection. |
boolean |
containsLayers(InnerLayer innerLayer)
Returns true if this list contains the specified layer. |
org.jdom.Element |
createXml()
Forge the net into xml. |
void |
extractNet(org.jdom.Element xmlNet)
This is the couterpart function of de.htwdd.rosenkoenig.neuro.net.createXml. |
boolean |
getInitialized()
Getter of the property initialized |
InputLayer |
getInputLayer()
Getter of the property inputLayer |
java.util.ArrayList<InnerLayer> |
getLayers()
Getter of the property layers |
InnerLayer |
getLayers(int i)
Returns the layer at the specified position in this list. |
double[] |
getOutput()
This function returns the member output of the last layer, which is the output layer. |
void |
initForTraining()
This function initializes the net for the training. |
boolean |
isLayersEmpty()
Returns true if this list contains no layers. |
java.util.Iterator<InnerLayer> |
layersIterator()
Returns an iterator over the layers in this list in proper sequence. |
int |
layersSize()
Returns the number of layers in this list. |
InnerLayer[] |
layersToArray()
Returns an array containing all of the layers in this list in proper sequence. |
InnerLayer[] |
layersToArray(InnerLayer[] layers)
Returns an array containing all of the layers in this list in proper sequence; the runtime type of the returned array is that of the specified array. |
void |
propagate(double[] pattern)
Fully connects the net's layers, if the net is not initialized and propagate the pattern given by pattern through all layers. |
boolean |
removeLayers(InnerLayer innerLayer)
Removes the first occurrence in this list of the specified layer (optional operation). |
java.lang.Object |
removeLayers(int index)
Removes the layer at the specified position in this list (optional operation). |
void |
setInitialized(boolean initialized)
Setter of the property initialized |
void |
setInputLayer(InputLayer inputLayer)
Setter of the property inputLayer |
void |
setLayers(java.util.ArrayList<InnerLayer> layers)
Setter of the property layers |
| Methods inherited from class de.htwdd.rosenkoenig.neuro.net.NeuralNet |
|---|
loadFromFile, saveToFile |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.Class[] CONSTRUCTOR_PARAMS
private boolean initialized
private InputLayer inputLayer
private java.util.ArrayList<InnerLayer> layers
| Constructor Detail |
|---|
public FeedForwardNet()
public FeedForwardNet(int inputLayerSize,
int outputLayerSize)
de.htwdd.rosenkoenig.neuro.net.addHiddenLayer to add hidden layers
to the net
inputLayerSize - number of neurons for the input layeroutputLayerSize - number of neurons for the output layer| Method Detail |
|---|
public void addHiddenLayer(int layerSize,
ActivationFunction activationFunction)
layerSize - size of the newly added hidden layeractivationFunction - activation function to be usedpublic final void propagate(double[] pattern)
propagate in class NeuralNetpattern - the input pattern to propagateprivate void connectLayers()
public double[] getOutput()
getOutput in class NeuralNetpublic org.jdom.Element createXml()
createXml in class NeuralNetpublic void extractNet(org.jdom.Element xmlNet)
de.htwdd.rosenkoenig.neuro.net.createXml. It
takes the xml representation of a net and converts it back into a net
extractNet in class NeuralNetxmlNet - the net's xml representation to be molded into a feed forward netpublic boolean getInitialized()
public void setInitialized(boolean initialized)
initialized - The initialized to set.public final void initForTraining()
public InputLayer getInputLayer()
public void setInputLayer(InputLayer inputLayer)
inputLayer - The inputLayer to set.public java.util.ArrayList<InnerLayer> getLayers()
public InnerLayer getLayers(int i)
index - index of layeer to return.
List.get(int)public java.util.Iterator<InnerLayer> layersIterator()
List.iterator()public boolean isLayersEmpty()
List.isEmpty()public boolean containsLayers(InnerLayer innerLayer)
innerLayer - layer whose presence in this list is to be tested.
List.contains(Object)public boolean containsAllLayers(java.util.Collection<InnerLayer> layers)
layers - collection to be checked for containment in this list.
List.containsAll(Collection)public int layersSize()
List.size()public InnerLayer[] layersToArray()
List.toArray()public InnerLayer[] layersToArray(InnerLayer[] layers)
layers - the array into which the layers of this list are to be stored.
List.toArray(Object[])
public void addLayers(int index,
InnerLayer innerLayer)
index - index at which the specified layer is to be inserted.innerLayer - layer to be inserted.List.add(int,Object)public boolean addLayers(InnerLayer innerLayer)
innerLayer - layer to be appended to this list.
List.add(Object)public java.lang.Object removeLayers(int index)
index - the index of the layer to removed.
List.remove(int)public boolean removeLayers(InnerLayer innerLayer)
innerLayer - layer to be removed from this list, if present.
List.remove(Object)public void clearLayers()
List.clear()public void setLayers(java.util.ArrayList<InnerLayer> layers)
layers - the layers to set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||