'Anyone who has never made a mistake has never tried anything new.' Albert Einstein
Github: Matrix
Github: Macine Learning Agent
Dropbox: Number Identifing Machine Learning Agent
To achieve a machine learning agent that can identify handwritten numbers I first needed a database of numbers and answers to use for training. The reason I chose this challenge is because the MNIST Database has such a database that I need.
Once I downloaded the MNIST database I had to convert that into an image for the user to see. All images are 28x28 and come as a list of numbers representing their gray scale value. I built a script to handle loading these into usable data for my machine learning agent and my user interface scripts. Then the user interface scripts could handle creating an image from the 2 dimensional array and the machine learning agent could be passed the array as an input.
Loading each image as needed was taxing and slowed the program down so I instead created a preload system to ready the data that was planned to be used by the agent. This way I could speed up training and only have to load each image once. This brought a few other small challenges such as making a loading screen so the user wouldn't think the script had crashed while it was preloading the images.
Training the agent to identify numbers took a lot longer than the XOR challenge. So for this agent I built a simple save and load mechanic so I could come back to it at a later date. After extensive training I then changed the data set for a second data set of hand written numbers to see how well the agent performed. I noticed a big drop in performance and after some testing realized the agent was relying on the order the data was being fed to it. To stop that I created a randomize mechanic to make sure the numbers are fed in a random order each time. This greatly improved the agent's accuracy after retraining.