a neural network trained to read handwritten digits, written from scratch in Scala
This project implements a simple neural network, then trains it using mini-batch stochastic gradient descent on the MNIST handwritten digit dataset. No fancy machine learning libraries here, this is written from scratch in plain Scala. I'm using Breeze for matrix algebra, and that's about it.
The project was inspired by Michael Nielsen's excellent textbook Neural Networks and Deep Learning, and my code is effectively a Scala port of Nielsen's algorithms.
$git clone https://github.com/vivshaw/scriptophile.git
$cd scriptophile
$sbt run
I typically get recognition accuracy in the 94%-95% range. An average run looks like this:
$sbt run
now training
Epoch 1 complete, with 8819 / 10000 correct
Epoch 2 complete, with 9065 / 10000 correct
Epoch 3 complete, with 9163 / 10000 correct
Epoch 4 complete, with 9245 / 10000 correct
...
Epoch 29 complete, with 9397 / 10000 correct
Epoch 30 complete, with 9422 / 10000 correct
final accuracy: 94.22%
- Rewrite in more idiomatic Scala
- Hunt for suspected implementation error causing poor recognition accuracy with large hidden layers