Answer the question
In order to leave comments, you need to log in
Why can't direct signal propagation be performed?
It is necessary to make a direct distribution of the network signal. As the network itself, I use an array of arrays of neurons (each nested array is a layer of the network).
public void forwardPropagation(ArrayList<Double> inputData)
{
int layersCount = neuronLayers.size();
for (int i = 0; i < layersCount; i++)
{
ArrayList<Neuron> layer = neuronLayers.get(i);
//если первый, входной слой
if (i == 0)
for (int j = 0; j < layer.size(); j++)
{
Neuron neuron = layer.get(j);
neuron.neuronValue = inputData.get(j);
layer.set(j, neuron);
}
else
{
ArrayList<Neuron> prevLayer = neuronLayers.get(i-1);
for (int j = 0; j < layer.size(); j++)
{
Neuron neuron = layer.get(j);
double sum = 0;
for (int k = 0; k < neuron.inputWeights.size(); k++)
{
Neuron prevNeuron = prevLayer.get(k);
sum += prevNeuron.neuronValue * neuron.inputWeights.get(k);
}
neuron.neuronValue = neuron.activate(sum);
layer.set(j, neuron);
}
}
this.neuronLayers.set(i, layer);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question