Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong hidden error computation #7

Open
Orbiter opened this issue Jul 23, 2021 · 0 comments
Open

wrong hidden error computation #7

Orbiter opened this issue Jul 23, 2021 · 0 comments

Comments

@Orbiter
Copy link

Orbiter commented Jul 23, 2021

in your lines https://github.com/kim-marcel/basic_neural_network/blob/master/src/main/java/basicneuralnetwork/NeuralNetwork.java#L165-L169

                weights[n - 1] = weights[n - 1].plus(deltas);

                // Calculate and set target for previous (next) layer
                SimpleMatrix previousError = weights[n - 1].transpose().mult(errors);
                target = previousError.plus(layers[n - 1]);

you calculate the target for the next (lower) level using the matrix previousError.
That uses the weights weights[n - 1] which had previously been altered with the correction factor.
What you require here is the unaltered weight to make the lower layer of the network backpropagation dependent on the original error with the original weight, not the altered weight.

From my point of view this can be fixed by moving the previousError line above the weights computation, like:

                SimpleMatrix previousError = weights[n - 1].transpose().mult(errors);
                weights[n - 1] = weights[n - 1].plus(deltas);
                target = previousError.plus(layers[n - 1]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant