B
B
BitNeBolt2020-07-10 14:31:38
Java
BitNeBolt, 2020-07-10 14:31:38

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).

Here
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);
        }
    }
function for forward propagation.

When I want to know the answer, I return the last layer of the network (in a separate method) and display these values. The problem is that regardless of the input data, the network produces the same answer. When I decided to look at the values ​​of the neurons, I found out that the values ​​of the input layer do not match the input data, I think that's the problem.

Why aren't values ​​assigned to the input layer?

PS I can post the neuron code upon request

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DDwrt100, 2020-07-10
@DDwrt100

what is a variable?
neuronLayers

B
BitNeBolt, 2020-07-10
@BitNeBolt

The code is correct, the error is elsewhere in the "project".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question