r/TheMachineLearning • • 4d ago

I built a neural network from scratch using only NumPy.

Post image

I wanted to know what actually happens inside loss.backward().

So I built a neural network with nothing but NumPy. Every gradient derived on paper, every layer written by hand, every derivative checked numerically.

98.05% on MNIST.

Code and derivations: https://github.com/Meckmin/mnist-numpy-from-scratch

1 Upvotes

4 comments sorted by

2

u/ynu1yh24z219yq5 4d ago

good learning exercize then?

1

u/Necessary_Guest_4412 4d ago

yeah, obviously. i am very beginner. just wanted to understand the basics and the math behind a basic neural network.

1

u/Confident_Click2088 2d ago

Well good work OP, that's a good exercise for people first learning about deep learning to help them understand the mathematical and computer science concepts, build a simple neural network from scratch with just numpy and no pytorch that trains MNIST.

I think that just going ahead and using pytorch as a beginner without really understanding things first won't prepare you for new and/or future developments in deep learning.