Click here to Skip to main content
13,901,646 members
Click here to Skip to main content
Add your own
alternative version


12 bookmarked
Posted 8 Sep 2016
Licenced MIT

Designer / Builder Artificial Neural Networks for Performance Evaluation of Structures

Rate this:
Please Sign up or sign in to vote.
It tests an ANN structure selector criteria for generic kinds of problems with ANNs.


Artificial Neural Networks (ANNs) can been used in many fields for a variety of applications. In spite of their unique advantages such as their non-parametric nature, arbitrary decision boundary capabilities, and easy adaptation to different types of data, they possess some inherent limitations.

The limitations come with the problem of structure. This problem has three factors: the number of hidden layers, the size of these layers, and the level of connectivity between layers.

These factors may affect the effectiveness of the classification and the estimates made by the network. Big artificial neural networks behave as memory banks, in which the parameters of input and output are almost memorized so that input vectors are within the range of the training set, the network will return almost identical values the actual data, but outside the whole, the values tend to be very different from the real ones.

Moreover, small networks have a poor performance in the classification, leading to improved performance in estimating outside the range of the training set.

In this article, backpropagation ANNs is used for supervised training, also, we will be focused on determining the structure of the best network, instead of modifying the networks structure (can be another article).


The main problem is finding the right structure to balance the size and the number of connections between the layers of the network so that it can classify and estimate at the same time with the least possible error.

In this project, we propose a generator of artificial neural networks trained with a set of data (from a CSV file). This dataset will be divided into two parts, a training set and a set of monitoring. Training iterations for each network with the training set will be carried out and ordered by a determined by the mean square error and the average of the magnitudes of differences in assessing trained with network monitoring assembly vector. A cut is made by selecting half of the best performing networks. The process is repeated until there is a winning network which is likely to have the best structure for the problem.

In each iteration, the number of training increases exponentially. Networks are trained in parallel, taking advantage that this kind of problem is parallelizable. Also, we used layers with Sigmoid transfer function, so that all inputs and outputs were normalized. The results, as well as the quadratic mean error values are standardized.

Also, this article refers to time independents problems, in which each training sample is independent of each other. Problems like automatic control problem are excluded in this solution. For these kind of problems, the network must be configured with n input vectors which represents the object state, the control vectors and the time elapsed between the n state and the n(t+1) state. The output vector must be the n(t+1) state of the object.

Using the Code

The BrainsProcessorBase Class

This class implements and defines some methods and properties that will be used by the three types of processors ANNs: Standalone, Master and Slave.

Creating the ANNs

The first step in creation of ANNs is to load the data to work with and select the output parameters. In this article, we will use data from a water supply system with eight bombs connected in different places and heights, with different characteristics. We will only use the water supplied data each day. The idea is to determine the influence of the system on each bomb, and generate ANNs capable of estimating the supply of a bomb, with the data of all remaining bombs. For complete information, we must have the whole supplied water data of a day.

After that, we will select the sizes and quantities of hidden layers like:

This will generate combinations of layers of one, two and three layers like 10-10-10 or 15-13-6 combinations. The method to do that (named Combox) looks like this:

    public List<int[]> Combox(ListBox listBox4)
            var l = new List<string>();
            var data = listBox4.Items.Cast<object>().Select(i => i.ToString().Split
            int ii = 0;
            foreach (var item in data)
                string a = "";
                var lx = new List<string>();
                for (int i = item[0]; i <= item[1]; i++)
                    a = "_" + i;
                    if ((l.Count <= item[1] - item[0]) && ii == 0)
                        foreach (var itemx in l.ToList())
                            lx.Add(itemx + a);
            return l.Distinct().Select(i => i.Split(new[] { "_" }, 

Standalone Mode

In this mode, the program generates all the structures and trains and tests all of them. In each iteration, take the best half following the selector criteria of the multiple of the mean squared error and the sum of differences between the calculated result and the result of the verification sample.

Using data from this polynomial function, and parameters as the following image:

The results of the iterations are displayed as follows:

Cluster Master Mode

In this mode, the program can be configured as master of the cluster, or slave serving to a master instance. The process is configured on each computer to be included on the cluster, and the mode of the operation is selected. Slaves instances cannot design the ANNs architectures, they only receive from the master instance groups of ANNs, the training set and the verification test. They run n training epochs and sends the results back to the master instance, which, with all ANNs trained and evaluated, it selects the best half of the group, redistributes all remaining ANNs, increases the number of training epochs and repeats the process until one ANN is the winner.

The parameters of the master cluster can be configured as follows:

Cluster Slave Mode

In this mode, the instance will be connected to a master instance and wait for instructions. It receives training and verification sets, the ANNs, trains all ANNs and sends it back to the master instance.

The Distribution Process

At the start of the training process, the master instance queries all registered slave’s instances to know the number of available cores and max speed of the CPU in each one. Then it assigns to each slave a number of ANNs (i) based on:

To slave instances that get a number less than one unit, the master assigns only one ANN to process in each iteration. For the rest of the slave instances, it assigns the floor(i) of ANNs. The master instance assumes all the remaining ANNs for training.


  • Taskin Kavzoglu, Determining Optimum Structure for Artificial Neural Networks. In Proceedings of the 25th Annual Technical Conference and Exhibition of the Remote Sensing Society, Cardiff, UK, pp. 675-682, 8-10 September 1999.


This article, along with any associated source code and files, is licensed under The MIT License


About the Author

Angel Gabriel Valdés Sarduy
Engineer AEI Aguas Varadero
Cuba Cuba
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionOthers usages Pin
ArnCaver14-Sep-16 20:23
memberArnCaver14-Sep-16 20:23 
AnswerRe: Others usages Pin
Angel Gabriel Valdés Sarduy15-Sep-16 5:34
professionalAngel Gabriel Valdés Sarduy15-Sep-16 5:34 
QuestionSource Code Pin
ArnCaver9-Sep-16 4:25
memberArnCaver9-Sep-16 4:25 
AnswerRe: Source Code Pin
Angel Gabriel Valdés Sarduy12-Sep-16 4:26
professionalAngel Gabriel Valdés Sarduy12-Sep-16 4:26 
AnswerRe: Source Code Pin
Angel Gabriel Valdés Sarduy13-Sep-16 10:27
professionalAngel Gabriel Valdés Sarduy13-Sep-16 10:27 
GeneralRe: Source Code Pin
ArnCaver23-Sep-16 2:27
memberArnCaver23-Sep-16 2:27 
GeneralRe: Source Code Pin
Angel Gabriel Valdés Sarduy23-Sep-16 2:59
professionalAngel Gabriel Valdés Sarduy23-Sep-16 2:59 
GeneralRe: Source Code Pin
ArnCaver23-Sep-16 3:15
memberArnCaver23-Sep-16 3:15 
GeneralRe: Source Code Pin
Angel Gabriel Valdés Sarduy23-Sep-16 4:01
professionalAngel Gabriel Valdés Sarduy23-Sep-16 4:01 
QuestionImages Pin
ArnCaver8-Sep-16 23:26
memberArnCaver8-Sep-16 23:26 
AnswerRe: Images Pin
Angel Gabriel Valdés Sarduy9-Sep-16 3:04
professionalAngel Gabriel Valdés Sarduy9-Sep-16 3:04 
GeneralRe: Images Pin
ArnCaver9-Sep-16 4:23
memberArnCaver9-Sep-16 4:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web05 | 2.8.190306.1 | Last Updated 23 Sep 2016
Article Copyright 2016 by Angel Gabriel Valdés Sarduy
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid