BerliOS Developer Logo


                     Syntactic Logo

                                The C++ Neural Network Library


Home

Download

About

Doc

ProjectSpace

     Welcome to the home page of syntactic. Syntactic is a simple C++ library for constructing general Neural networks. For now the library supports creation of multi layered networks for the Feedforward Backpropagation algorithm as well as Time Series Networks. In time, Kohonen and Associative type of networks will be included in the library. This project was born out of another, when it required a Feedforward Backpropagation algorithm for pattern recognition.

      The coding required for creating a network is amazingly simple. For example to create a neural network to simulate an 2 input Ex-OR logical great, the following coding would be required:

                                             VVNetwork xornet (3, 2, 2, 1, 0.8, 0.3);
                                                         xornet.vvtransfer_function = VV_SIGMOID_HALF;
                                                         xornet.vvtransfer_function_derivative = VV_SIGMOID_HALF_DERIV;
                                                         xornet.VVreadinputfrom("xor.in");
                                                         xornet.VVreadoutputfrom("xor.out");
                                                         xornet.vvautobias();


      Hence we have created a simple network with 3 layers consisting of a 2 neuron input layer, 2 neuron middle layer and a single neuron output layer, a learning rate of 0.8 and momentum of 0.2. Then we have asked the network to use a half sigmoid function for the transfer function. In a similar manner we have specified the derivative of the half sigmoid function. Next we specify the input and output data for the training. Lastly we enable autobiasing for all non-input neurons. Now the network is ready to begin training. To train we simply do:

                                                 int times=3000;    
                                                            for(int i=0;i<times;i++)  
                                                                      xornet.VVnetwork_train();
                                                          
                                                            xornet.VVsave_network("xor.nnw");


       Thus the network is trained in 3000 iterations, and saved as 'xor.nnw'. The training is complete. Now suppose we wish to use this network at a later stage, we then load the network like this:

                                                                  VVNetwork xor;
                                                                   xornet.VVload_network("xor.nnw");
                                                                   xornet.vvtransfer_function = VV_SIGMOID_HALF;
                                                                   xornet.vvtransfer_function_derivative = VV_SIGMOID_HALF_DERIV;
                                                                   vector<double> out;

                                                                   out=xornet.VVtest_network("test");


        Now the output of the network will be stored in the double vector out. In this case, just one output
. Hence we have both trained and tested a network with a few simple lines of code.
                                               
                              For queries, help and troubleshooting, contact: oper17 dot inc AT gmail dot com