I have 3 classes: Neuron,Layer, Network.
A Layer contains a collection of Neurons and a Network contains a collection of Layers.
A neuron has(attributes) a collection of inputs(Double) and only one output(Double).
Inside the network class I have:
private ArrayList<Layer> layers;
I would like to cycle through every layer in layers and through every neuron in the neurons of the current layer and set their individual output as inputs of every neuron of the next layer until I have gone through all the layers.
Now I have the following method which tries to accomplish this:
public void execute(){
//Connecting Network
for (Layer l : layers){
int counter = 0;
while (counter < layers.size()){
for (Neuron n: l.neurons ){
neuronOfNextLayer.addInputs(neuronOfPreviousLyaer.output);
}
counter++;
}
}
}
Now how would I replace the
neuronOfNextLayer.addInputs(neuronOfPreviousLyaer.output);
part of the loop for something that actually goes through the ouputs of every layer in layers and sets the as inputs of every neuron of the next layer?
I assume you already have field variable “Inputs” in class “Neuron”.
So you may replace the code
neuronOfNextLayer.addInputs(neuronOfPreviousLyaer.output);
with:
If this doesnot help you, Please cleary the question .