I am trying to use julia to create a simple a readable backpropagation implementation ( mostly following https://machinelearningmastery.com/implement-backpropagation-algorithm-scratch-python/ ), but it is training really slowly ( take more steps to decrease the error, and bottoms out at a higher error ) compared to an identical reference implementation with zygote's AD to calculate gradients.
Here is the from scratch backprop: https://github.com/AlistairKeiller/MLjulia/blob/main/simple.jl
And here is the zygote implementation: https://github.com/AlistairKeiller/MLjulia/blob/main/zygote.jl
Here is a run from custom backprop:
error: 1.0007393
error: 0.24435842
error: 0.21032272
error: 0.19531001
error: 0.18624645
error: 0.18023509
error: 0.17640144
error: 0.17355171
error: 0.17135184
error: 0.16990495
Her is a run from zygote backprop:
error: 0.9004709
error: 0.16243693
error: 0.12893249
error: 0.11488452
What am I doing wrong?
The backpropagation algorithm is used in the classical feed-forward artificial neural network. It is the technique still used to train large deep learning networks. In this tutorial, you will discover how to implement the backpropagation algorithm for a neural network from scratch with Python. After completing this tutorial, you will know: How t...