Hi guys,
In this section, we are building a digit classifier. I have taken the famous ML course from Andrew Ng on Coursera, so I thought, why not build a neural network model for classifying digits from scratch?
It took me days to build the feedforward function and the backpropagation function to compute the cost and gradient. Just when I thought everything’s done, and I plug my functions in the scipy.optimize.fmin_g, it doesn’t work as I expected. I think my cost function is fine because when I don’t plug in the cost gradient function in as the parameter fprime
for fmin_gc()
, in which case the gradient is approximated numerically, it does work. I set the maxiter = 100
in this notebook because otherwise, it takes too long in DQ env. As you can see the accuracy is pretty low.
If I plug in the cost gradient function in fprime
, it only iters once and it’s the cost function is not optimized. I would love to start a discussion with anyone who has used the scipy.optimize
library.
This project is not successful, but I still want to share it, and maybe get some feedback on how to fix it. All aside, I’ve learned a lot of quirky stuff about numpy with this project and obtained a much better understanding of the neural network.
It’s unfinished business, but for now, I just need to take a long break.
Building a neural network model from scratch.ipynb (73.1 KB)
Click here to view the jupyter notebook file in a new tab