Demo application for the RProp algorithm using matrices

Dear Reader,

I decided to publish an old version of the RProp algorithm I wrote back in 2003 that demonstrates how the algorithm modified to use matrix algebra works.

The demo can be downloaded from here, both source files and binaries:
https://github.com/bulyaki/TNeuralNetwork

Right now I don’t have any means to make changes to it as I haven’t used Borland C++ builder for ages.

Here is how to use it:

First you have to click on the “Load CSV” button. For this purpose you need a CSV file that contains both the inputs and the desired targets (training patterns) for the Neural Network.

1

 

Each column is either an input vector or an output vector, inputs come first, outputs afterwards. So they should look something like this (this is a snippet from the Powers.csv file contained in the repository):

-75,5625,-421875,31640625,-2373046875,8.660254038
-74.9,5610.01,-420189.749,31472212.2,-2357268694,8.654478609
-74.8,5595.04,-418508.992,31304472.6,-2341574551,8.648699324
-74.7,5580.09,-416832.723,31137404.41,-2325964109,8.642916175
-74.6,5565.16,-415160.936,30971005.83,-2310437035,8.637129153
-74.5,5550.25,-413493.625,30805275.06,-2294992992,8.631338251
-74.4,5535.36,-411830.784,30640210.33,-2279631649,8.625543461
-74.3,5520.49,-410172.407,30475809.84,-2264352671,8.619744776
-74.2,5505.64,-408518.488,30312071.81,-2249155728,8.613942187
-74.1,5490.81,-406869.021,30148994.46,-2234040489,8.608135687
-74,5476,-405224,29986576,-2219006624,8.602325267

The piece of data above has one inputs, and 5 outputs. The inputs are numbers from -75.0 to -74.0 with 0.1 increments. The outputs are second, third, …, sixth powers of the inputs.
Out1 = In^2
Out2 = In^3
Out3 = In^4
Out4 = In^5
Out5 = In^6

Then you will have to specify how many inputs and outputs you wish to connect to your Neural Network:

2

Now that we know the number of inputs and outputs, you have to specify the dimensions of your neural network. Let’s create a network with two hidden layers, with each layer containing 10 neurons:

3

We can leave the number of iterations 1000. Then click on the “Start” button:

4

The graph in the middle shows the regression of the output and the training vectors. In the powers.csv file the first output is a parabola function (y=x^2, x=[-75.0 … +75.0]).
On the above photo you can see how both sides of the parabola is taking shape, and eventually it will reach a close to 45 degree straight line (well, more or less).

Obviously neural networks should not be used to for functions where we know the connection between input and output variables, but such functions are very useful for testing our network and our algorithm.

Please note that I created the above application about 14 years ago, so the code in the repository is NOT a faithful representation of my programming and design abilities. Also, if you find bugs in the code you are welcome to fix them yourself, but I will not be able to make any further modifications to it. This application had lots of versions, some of which were able to display the matrices of the network in 3D using OpenGL, some allowing you to create various network topologies using a bespoke designer UI, but all these versions were unfinished and probably buggy. The one in the repository is probably the cleanest source I have that solely concentrates on the matrix form of the RProp algorithm itself.

I am already working on a C# version of this algorithm which I’m planning to publish in the coming weeks. Also once ready, I plan to republish these blog posts as one long article on CodeProject.

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s