Neural Network Engine

The Neural Network Engine (NNE) is a C++ program that I created as an exercise in understanding the basics and low-level operation of machine learning. It contains a self-written matrix library and several kinds of "layer" classes that when connected together, form a network. The NNE is currently geared towards solving the MNIST handwritten digit classification problem but is highly scalable and will easily adapt to other, more complicated problems.

 
 
Output from the NNE. Shown above, the NNE successfully classifies the digit '6' with zero error.

Output from the NNE. Shown above, the NNE successfully classifies the digit '6' with zero error.

NNE and the MNIST Dataset

The NNE is currently being used to classify items in the MNIST data set. This problem involves the use of alternating convolutional and pooling layers to break down 28x28 grayscale images of handwritten digits into a series of features and MLP layers to classify the digits based on those features. Shown to the left is the successful classification of the digit '6'.


NNE and the MNIST Dataset Cont.

The alternating convolutional and pooling layers extract the principal components of the digits and compress the convolved images to be more manageable for the MLP classification layers. 

The convolved images produced by the network's convolutional layers. 

The convolved images produced by the network's convolutional layers. 


A partial class diagram for the NNE generated in Visual Studio

A partial class diagram for the NNE generated in Visual Studio

Code Organization and PolyMorphism

The C++ code is organized such that networks can be created and executed in a very modular and intuitive fashion. Layer classes are organized by types, currently including pooling, element-wise, MLP, and convolutional. All inherit from the virtual layer class which provides a common interface for layer interaction.


User Interface

The user interacts with the NNE through Matlab where all the high-level C++ functions have a coresponding Matlab "wrapper" function. Wrapper functions are called in Matlab and instructions are sent to the NNE via tcp. The use of Matlab provides a familiar data analysis environment and allows the user more flexibility.

A Matlab plot of MNIST problem fitness. This particular run is using 35 pooling and convolutional layers, two MLP layers, and the Adam adaptive learning rate algorithm.

A Matlab plot of MNIST problem fitness. This particular run is using 35 pooling and convolutional layers, two MLP layers, and the Adam adaptive learning rate algorithm.