A MATLAB implementation of the TensorFlow Neural Networks Playground.
Inspired by the TensorFlow Neural Networks Playground interface readilyavailable online, this is a MATLAB implementation of the same Neural Networkinterface for using Artificial Neural Networks for regression andclassification of highly non-linear data.
The interface uses the HG1 graphics system in order to be compatible witholder versions of MATLAB. A secondary purpose of this project is to write avectorized implementation of training Artificial Neural Networks withStochastic Gradient Descent as a means of education and to demonstrate thepower of MATLAB and matrices.
The goal for this framework is given randomly generated training and test datathat fall into two classes that conform to certain shapes or specifications,and given the configuration of a neural network, the goal is to perform eitherregression or classification of this data and interactively show theresults to the user, specifically a classification or regression map of thedata, as well as numerical performance measures such as the training and testloss and their values plotted on a performance curve over each iteration.The architecture of the neural network is highly configurable so the resultsfor each change in the architecture can be seen immediately.
There are two files that accompany this repo:
NeuralNetApp.m
: The GUI that creates the interface as seen on TensorFlowNeural Networks Playground but is done completely with MATLAB GUI elementsand widgets.NeuralNet2.m
: The class that performs the Neural Network training viaStochastic Gradient Descent. This is used by the NeuralNetApp.m
app.Debugged and tested for MATLAB R2009b or newer.
This code can only be run on versions from R2009b and onwards due to thesyntax for discarding output variables from functions via (~
). If you wishto use this code for older versions (without guaranteeing compatibility), youwill need to replace all instances of discarding output variables with dummyvariables but you'll be subject to a variety of mlint
errors. This efforthas not been done on our part as there is very little gain to go to even olderversions and so if you desire to run this code on older versions, you willhave to do so yourself.
Ensure that both files NeuralNetApp.m
and NeuralNet2.m
are in the samedirectory. In the MATLAB Command Window, simply run the NeuralNetApp.m
filewithin this directory. Assuming you are working in the directory of where youstored, type in the following and press ENTER:
>> NeuralNetApp
If you want to be explicit, you can use run
and provide the path to wherethis file is located on your system:
>> run(fullfile('path', 'to', 'the', 'NeuralNetApp.m'));
If all goes well, you should be presented with a GUI.See here for the output from a sample run.
The main engine before the training algorithm is seen in the NeuralNet2.m
file. This is a custom class that was written and is well documented to allowa MATLAB user to use it for their purposes in future code that they write.You can type in help NeuralNet2
in the command window where this file islocated on your system for a comprehensive overview on how to use this class.
Check out this page for some tips on training the neural network.