Skip to content

a neural network trained to read handwritten digits, written from scratch in Scala

License

Notifications You must be signed in to change notification settings

vivshaw/scriptophile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scriptophile

a neural network trained to read handwritten digits, written from scratch in Scala

What It Is

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.

How To Use It

$git clone https://github.com/vivshaw/scriptophile.git
$cd scriptophile
$sbt run

Typical Results

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%

To-dos

  • Rewrite in more idiomatic Scala
  • Hunt for suspected implementation error causing poor recognition accuracy with large hidden layers

About

a neural network trained to read handwritten digits, written from scratch in Scala

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages