Click here to Skip to main content
Click here to Skip to main content

Neural Networks on C#

By , 19 Nov 2006
 
Prize winner in Competition "C# Oct 2006"

Sample Image - neuron.jpg

Introduction

It is known fact, that there are many different problems, for which it is difficult to find formal algorithms to solve them. Some problems cannot be solved easily with traditional methods; some problems even do not have a solution yet. For many such problems, neural networks can be applied, which demonstrate rather good results in a great range of them. The history of neural networks starts in 1950-ies, when the simplest neural network's architecture was presented. After the initial work in the area, the idea of neural networks became rather popular. But then the area had a crash, when it was discovered that neural networks of those times are very limited in terms of the amount of tasks they can be applied to. In 1970-ies, the area got another boom, when the idea of multi-layer neural networks with the back propagation learning algorithm was presented. From that time, many different researchers have studied the area of neural networks, what lead to a vast range of different neural architectures, which were applied to a great range of different problems. For now, neural networks can be applied to such tasks, like classification, recognition, approximation, prediction, clusterization, memory simulation, and many other different tasks, and their amount is growing.

In this article, a C# library for neural network computations is described. The library implements several popular neural network architectures and their training algorithms, like Back Propagation, Kohonen Self-Organizing Map, Elastic Network, Delta Rule Learning, and Perceptron Learning. The usage of the library is demonstrated on several samples:

  • Classification (one-layer neural network trained with perceptron learning algorithms);
  • Approximation (multi-layer neural network trained with back propagation learning algorithm);
  • Time Series Prediction (multi-layer neural network trained with back propagation learning algorithm);
  • Color Clusterization (Kohonen Self-Organizing Map);
  • Traveling Salesman Problem (Elastic Network).

The attached archives contain source codes for the entire library, all the above listed samples, and some additional samples which are not listed and discussed in the article.

The article is not intended to provide the entire theory of neural networks, which can be found easily on the great range of different resources all over the Internet, and on CodeProject as well. Instead of this, the article assumes that the reader has general knowledge of neural networks, and that is why the aim of the article is to discuss a C# library for neural network computations and its application to different problems.

Using the library

Designing the library, one of the main ideas was to make it flexible, reusable, and easy to use and understand. Instead of combining several neural network entities into a single class and making a mess, which leads to loosing flexibility and clarity in the code and design, all entities were split into distinct classes, making them easer to understand and reuse. Some neural networks libraries tend to combine the entity of neuron's network together with the learning algorithm, what makes it hard to develop another learning algorithm which can be applied to the same neural network architecture. Some other libraries and applications do not extract such entities, like neurons, layers of neurons, or a network of layers, but implement the entire neuron network architecture in a single class. In some cases, it is arguable what is better, because there may be such unusual neural network architectures, where it is hard to split the network into layers and neurons. In some other cases, networks do not tend to multi-layer architecture, so it may be useless to have an additional entity like layer. But in most cases, it is favorable to split all these entities into distinct classes, what leads not only to easier understanding, but also allows reusing of all these components and building new neural networks architectures from smaller generic pieces.

The library contains six main entities:

  • Neuron - a base abstract class for all neurons, which encapsulates such common entities like a neuron's weight, output value, and input value. Other neuron classes inherit from the base class to extend it with additional properties and specialize it.
  • Layer - represents a collection of neurons. This is a base abstract class, which encapsulates common functionality for all neuron's layers.
  • Network - represents a neural network, what is a collection of neuron's layers. This is a base abstract class, which provides common functionality of a generic neural network. To implement a specific neural network architecture, it is required to inherit the class, extending it with specific functionalities of any neural network architecture.
  • IActivationFunction - activation function's interface. Activation functions are used in activation neurons - the type of neuron, where the weighted sum of its inputs is calculated and then the value is passed as input to the activation function, and the output value becomes the output value of the neuron.
  • IUnsupervisedLearning - interface for unsupervised learning algorithms - the type of learning algorithms where a system is provided with sample inputs only during the learning phase, but not with the desired outputs. The aim of the system is to organize itself in such a way to find correlation and similarities between data samples.
  • ISupervisedLearning - interface for supervised learning algorithms - the type of learning algorithms where a system is provided with sample inputs, with desired output values during the learning phase. The aim of the system is to generalize learning data, and learn to provide the correct output value when it is presented with the input value only.

AForge.Neuro class diagram

The library provides the following neural network architectures:

  • Activation Network - the neural network where each neuron computes its output as the activation function's output, and the argument is a weighted sum of its inputs combined with the threshold value. The network may consist of a single layer, or of multiple layers. Trained with supervised learning algorithms, the network allows to solve such tasks as approximation, prediction, classification, and recognition.
  • Distance Network - the neural network where each neuron computes its output as a distance between its weight values and input values. The network consists of a single layer, and may be used as a base for such networks like Kohonen Self Organizing Map, Elastic Network, and Hamming Network.

Different learning algorithms are used to train different neural networks, and are used to solve different problems:

  • Perceptron Learning [1] - the algorithm may be considered as the first neural network learning algorithm, and its history starts from 1957. The algorithm may be used with a one-layer activation network, where each neuron has a threshold activation function. The range of its applications are rather small and limited the with classification of linearly separable data.
  • Delta Rule Learning [2] - the algorithm is a next step after the perceptron learning algorithm. It utilizes the activation function's derivative, and may be applicable to single-layer activation networks only, where each neuron has a continuous activation function instead of a threshold activation function. The most popular continuous activation function is the unipolar and bipolar sigmoid function. Because the algorithm may be applied to one-layer networks only, it is limited to some classification and recognition tasks mostly.
  • Back Propagation Learning [3] - this is one of the most popular and known algorithms for multi-layer neural network learning. Initially, it was described in 1974, and from that time, it was extensively studied and applied to a broad range of different tasks. Because the algorithm is able to train multi-layer neural networks, the range of its applications is very great, and includes such tasks as approximation, prediction, object recognition, etc.
  • SOM Learning [4] - this algorithm was developed by Kohonen, and may be considered as one of the most famous unsupervised learning algorithms for clusterization problems. It treats neural network as a 2D map of nodes, where each node may represent a separate class. The algorithm organizes a network in such a way, that it becomes possible to find the correlation and similarities between data samples.
  • Elastic Network Learning [5] - the algorithm is similar to the idea of the SOM learning algorithm, but it treats network neurons not as a 2D map of nodes, but as a ring. During the learning procedure, the ring gets some shape, which represents a solution. One of the most common demonstrations of this learning algorithm is the Traveling Salesman Problem (TSP).

AForge.Neuro help file

For additional source of information, the library is provided with help information, which is distributed in HTML help format.

Classification

Classification Application

This sample demonstrates the use of a one-layer activation network with a threshold activation function and the use of the perceptron learning algorithm. The neuron's amount of the network is equal to the amount of different data classes, and each neuron is trained to classify certain classed only. Passing a data sample to the trained network, one neuron of the network should get activated (produce output equal to 1), but all other neurons should get deactivated (produce output equal to 0). The class of the data sample is determined by the activated neuron's number. In the case, if several neurons become activated or none of them, the network is unable to classify the presented data sample correctly. In the case of 2D data samples, it is very easy to visualize the network, because weights and threshold value of each neuron represents a line, which separates one class from all others.

// prepare learning data
double[][] input = new double[samples][];
double[][] output = new double[samples][];
// ... preparing the data ...

// create perceptron
ActivationNetwork network = new ActivationNetwork( new ThresholdFunction( ), 
                                                   2, classesCount );
// create teacher
PerceptronLearning teacher = new PerceptronLearning( network );
// set learning rate
teacher.LearningRate = learningRate;
// loop
while ( ... )
{
    // run epoch of learning procedure
    double error = teacher.RunEpoch( input, output );
    ...
}

Despite the network's architecture simplicity, it can be used for many different classification/recognition tasks. The only limitation of this architecture is that the network may classify only linearly separable data.

Approximation

Approximation Application

This sample demonstrates the use of multi-layer neural networks trained with the back propagation algorithm, which is applied to a function's approximation problem. Suppose that we know the function's value only in a limited amount of points, but we would like to calculate the function in some other points as well, which are in the range of min and max X values, for which we know the value of the function. During the training phase, the network is trained to produce the correct function's value for the presented X value. After the training is done, the network is used to calculate the function's value for different other values which were not available for the network during the training procedure.

// prepare learning data
double[][] input = new double[samples][];
double[][] output = new double[samples][];
// ... preparing the data ...
// create multi-layer neural network
ActivationNetwork    network = new ActivationNetwork(
    new BipolarSigmoidFunction( sigmoidAlphaValue ),
    1, neuronsInFirstLayer, 1 );
// create teacher
BackPropagationLearning teacher = new BackPropagationLearning( network );
// set learning rate and momentum
teacher.LearningRate = learningRate;
teacher.Momentum     = momentum;
// loop
while ( ... )
{
    // run epoch of learning procedure
    double error = teacher.RunEpoch( input, output ) / samples;
    ...
}

The network architecture may be used for approximation of not just two-dimensional functions. A function of arbitrary dimensions may be approximated with a multi-later neural network. But do not forget that the amount of the network's layers and neurons and such parameters like sigmoid's alpha value may affect the learning speed very drastically. Some incorrect settings of your network may lead to the inability to learn anything at all. So, be careful and try to experiment more.

Time Series Prediction

Time Series Prediction Application

This sample also demonstrates a multi-layer neural network with back propagation learning algorithm, but applied to a different task - time series prediction. The problem of time series prediction is very important and a very popular problem, and many researchers work in the area trying many different algorithms and methods for the task. It is easy to explain the popularity of the problem by taking a look at areas where it can be applied. One of the popular areas is trades - if you can predict future values of stocks or rates of currency exchanges, then ... if you can do it really well, then you may become a rich man. But, let's return to neural networks. During the training phase, certain amount of previous values of the time series are presented to the network, and the network is trained to predict the next value of the time series. The more training samples you have, the better prediction models you may get. Also, a very important parameter is window size - how many values from the history are used to predict the future one. The larger the window size you have, the better model you may get, but may not - depending on the time series, and require experiments. But, a larger window size will decrease the amount of training samples you need, so it is a trade off value.

The sample code for this problem is the same like in the previous example, only the procedure of preparing the learning data is changed.

Color Clusterization

Color Clusterization Application

This is a very simple sample, which demonstrates the process of the Kohonen Self-Organizing Map's organization. A square SOM network is created, which consists of 10000 neurons with randomly initialized weights. Each neuron has three weights, which are interpreted as RGB values for visualization. So, the initial visualization of the network will show some sort of noisy colored map. During the learning procedure, random colors are picked and passed to the network's input one by one. Repeating learning iterations, the neural network organizes itself in such a way that it no longer looks like a random picture during visualization, but it gets a certain structure - colors, which are close on the RGB palette, also placed closer on the Kohonen map too.

// set neurons weights randomization range
Neuron.RandRange = new DoubleRange( 0, 255 );
// create network
DistanceNetwork network = new DistanceNetwork( 3, 100 * 100 );
// create learning algorithm
SOMLearning trainer = new SOMLearning( network );
// input
double[] input = new double[3];
// loop
while ( ... )
{
    // update learning rate and radius
    // ...

    // prepare network input
    input[0] = rand.Next( 256 );
    input[1] = rand.Next( 256 );
    input[2] = rand.Next( 256 );

    // run learning iteration
    trainer.Run( input );
    
    ...
}

Playing with this sample, you will find that the neural network creates different pictures always, and it is rather interesting to observe the process of the map's organization. May be an idea for screen saver ...

Instead of colors, any other object could be used, which could be described with a real-valued vector of features. Passing these feature vectors to the Kohonen map during the learning procedure, will lead to its organization, so after the training procedure is finished, you can take a look at the 2D map, and discover which objects are similar and close to each other according to their features.

Traveling Salesman Problem

Traveling Salesman Problem Application

The traveling salesman problem demonstrates the use of the Elastic Network, which is similar to SOM in the concept of self-organizing, but differs in the neural network's interpretation. SOM interprets a neural network as 2D map of nodes, but the Elastic Network interprets it as a ring of nodes. During the training phase, feature vectors are presented to the network one by one, what makes the network to get some sort of a shape, which represents a solution. In the case of the TSP problem, each neuron of the network has two weights, which represent (X, Y) coordinates. During the training phase, coordinates of arbitrary cities are passed to the network's input one by one, and the network organizes its weights in such a way, that they represent a path of the traveling agent.

// set random generators range
Neuron.RandRange = new DoubleRange( 0, 1000 );
// create network
DistanceNetwork network = new DistanceNetwork( 2, neurons );
// create learning algorithm
ElasticNetworkLearning trainer = new ElasticNetworkLearning( network );
// input
double[] input = new double[2];
// loop
while ( ... )
{
    // set network input
    int currentCity = rand.Next( citiesCount );
    input[0] = map[currentCity, 0];
    input[1] = map[currentCity, 1];

    // run one training iteration
    trainer.Run( input );
    ...
}

The disadvantage of this method is that it does not provide an exact solution - the neuron's weights may be close to city coordinates, but may be not equal to them. Another disadvantage of this method is that it does not produce a good result on a large number of cities. But still, the method is a nice demonstration of the neural network's application.

Conclusion

The five presented samples demonstrate that the initial aim of the library was achieved - it is flexible, reusable, and it is easy to use it for different tasks. Although, there is still much work to do, because of a great range of different neural network architectures and their learning algorithms, but still - the library can be used for many different problems, and can be extended to solve even more. I hope the library will become useful not only in my further research work, but other different researchers will find it interesting and useful. 

References

  1. Perceptron, from Wikipedia, the free encyclopedia.
  2. Delta Rule, from Wikipedia, the free encyclopedia.
  3. Back Propagation, from Wikipedia, the free encyclopedia.
  4. Self-Organizing Map, from Wikipedia, the free encyclopedia.
  5. Elastic Net Tutorial, Andrei Cimponeriu, October 12, 1999.

History

  • [19.11.2006] - Initial publication of the article.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

About the Author

Andrew Kirillov
Software Developer (Senior)
United Kingdom United Kingdom
Member
Started software development at about 15 years old and it seems like now it lasts most part of my life. Fortunately did not spend too much time with Z80 and BK0010 and switched to 8086 and further. Similar with programming languages – luckily managed to get away from BASIC and Pascal to things like Assembler, C, C++ and then C#. Apart from daily programming for food, do it also for hobby, where mostly enjoy areas like Computer Vision, Robotics and AI. This led to some open source stuff like AForge.NET.
 
Going out of computers I am just a man loving his family, enjoying traveling, a bit of books, a bit of movies and a mixture of everything else. Always wanted to learn playing guitar, but it seems like 6 strings are much harder than few dozens of keyboard’s keys. Will keep progressing ...

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionTraining data transformationmemberEizenhaier6 May '13 - 23:44 
Hi Andrew. Thank you for your NN post.
I am junior in neural netwroks and I have one question.
Why did you use transformed input training data to teach a network?
 
// set input
input[i][0] = (data[i, 0] - xMin) * xFactor - 1.0;
// set output
output[i][0] = (data[i, 1] - yMin) * yFactor - 0.85;
 
That code use xFactor and yFactor variables which are declared here:
double yFactor = 1.7 / chart.RangeY.Length;
double xFactor = 2.0 / chart.RangeX.Length;
 
Tell me please - why we need to transform input data to train a network?
GeneralMy vote of 5mvpKanasz Robert6 Nov '12 - 0:00 
very good article. Well done!
GeneralMy vote of 5memberVHGN5 Jul '12 - 1:08 
... if you can do it really well, then you may become a rich man.
 
Like Smile | :) )
QuestionExtract a clustermemberGepard_vvk25 May '12 - 0:40 
How i can extract cluster in SOM Color sample like this http://www.mperfect.net/aiSomPic/random9Colors.JPG[^]
Questionhelp regarding Aforge.Neuromemberlivelife8626 Mar '12 - 19:19 
I am new to NN ,I wish to implement a simple network in C#, which takes 5 input neurons and outputs one value and i want the threshold to be decided using the simple avg function as the activation function.
input:{2,4,6,8,9}
weights:{0.023,0.059,0.075,0.022,0.046}(random weights)
activation function(or the threshold value): (sum of all (i*w))/5
thus it gives a value as output,which is nothing but an average of the input values.
 
please tell me how to code it in C# using Aforge.Neuro
thanks
QuestionDoes Color Clusterization reflects a pseudo-random number generator?memberJacek Gajek14 Mar '12 - 22:48 
Hello,
 
Does a Color Clusterization picture in your article reflect a pseudo-random number generator characteristics? Either a neural network and pseudo-random generator are deterministic. Is it possible to predict further pseudo-random numbers for different generators (let say we use the same seed value each time)?
 
Great article, BTW
Greetings - Jacek

GeneralGratitudes and One Questionmembermacmanaman_15 Feb '12 - 20:19 
Hi Andrew,
 
First thank you for such a great framework. I have a question for you. I am trying to implement a prediction system using Aforge.Neuro. But while training, calculated error is huge and after 10k steps change in the error is very small. Do you have any idea about this?
 
Any answer would be appreciated.
 
Murat
Questionsaving the SOMmembershekarchee29 Dec '11 - 7:30 
How do you save the SOM and use it later when there is no need to retrain the network?
GeneralMy vote of 2memberalggg9 Jul '11 - 22:41 
protected static DoubleRange randRange = new DoubleRange( -0.0, 1.0 );
Correct [-1.0, 1.0]
QuestionPredict is a fake one?memberchiwawa77712 May '11 - 6:41 
There is prediction in Sample TimeSeries. But those datas which are on the right side of prediction line joined into learning process again and again in the source code.
Am I wrong? or it is a fake prediction?
GeneralObject Recognition and machine learningmembermaneesha vashishtha2 May '11 - 0:37 
Hi ,
I am making a project on objectrecognition and machine learning.I am using AForge.Net for this project.
I am able to recognise some objects on the basis of colors using their rgb values.But it is misinterpreting some objects which have somewhat same rgb values.I want to incorporate something as a combination of both shape and rgb values or something on the basis of shape.
Please help me on this or if there is any other way to do the recognition part.
 
Hope to hear soon.
 

Regards,
Maneesha Vashishtha
Questionneural networmemberMember 766996614 Feb '11 - 2:26 
please the code dont execute why?
GeneralPassing text to the input layermemberBrightSoul14 Jan '11 - 0:23 
I'd like to use a neural network to determine whether two blocks of text are telling the same story or not.
My biggest problem is: how do I convert a variable length string to an array of doubles?
 
I thought that I might get the numeric value for each character but, suppose my text is 200 words long, I would end up with a thousand neurons just on the input layer. Won't this slow the execution at a snail's pace?
Generaltime series predictionmemberyuriythebest13 Jan '11 - 11:49 
Hi! Excellent project! However, I tried loading the Data Samples for the backpropagation/time series prediction program and in all of em it says "failed reading the file"- I've tried this with both the version I downloaded and compiled and also the demo (precompiled)- same result. I've even tried placing the data sample in C:\ root but that didn't help either. thanks in advance!
GeneralRe: time series predictionmembermehreeizad22 Jan '11 - 16:22 
Hi! I had same experience before. If you try to load file with multiple column data (x1,x2) you get this error. Data file must be one column data. However If you like I can try to find problem, Please email me your data file. (mehrdadfaderani@yahoo.com)
GeneralSample code for using the approximation demo for the AForge librarymemberNgolah30 Sep '10 - 5:57 
Hi all,
 
I am learning Neural networks. I find the AForge library very useful but would like to see how the nueral network for the approximation demo is implemented. In particular, I will like to see how the input array and output arrays are used. I shall be most grateful if somebody can help. Is is possible to have Andrew Kilrillov's email?
Thanks
C. Maleh

Generalбольшие ошибкиmemberbroker2519 Aug '10 - 22:30 
вещь полезная, но хотелось бы отметить:
 
не указано, что обязательна предобработка инпутов,
 
корректно работает только первый раз, перезапуск после рандомизации выдает вообще какую-то чепуху. Это плохо так как вероятны локальные минимумы. Ошибка в сравнении с другой библиотекой оказалась намного выше, наверно из-за отсутствия перезапуска. Вообще не ясно борется ли с локальными минимумами или нет. Рекомендую добавить перезапуск и борьбу с минимумами
 
Из плюсов: простота, удобство встройки алгоритма в свои сети
GeneralMy vote of 5memberKeith Barrow12 Aug '10 - 23:11 
Excellent article with really nice training examples!
General.CHM Files not loadingmemberFrankinstienCode9 Jul '10 - 8:17 
I've tried to use the AForge.Neuro.chm and the AForge.Core.chm files but none of the html files are showing up. I've tried to use the jump to URL to where the .chm files are located but still the help html doesn't load or exist. Any ideas as to why the .chm files aren't working?
 
Frank
GeneralRe: .CHM Files not loadingmemberrbunn8381515 Jan '11 - 10:09 
Right click on the chm file then select "Properties". If a button labeled "Unblock" exists, then click on it.
 
Bob
Generalbackpropagation with 6 input and 2 outputmemberh4ckm03d16 Jun '10 - 16:26 
I've try to make implementation using Aforge to solve problem with 6 input and two output using sigmoid activation. But the result is bad. Can anyone help to solve the problem?
thx all.
QuestionPrediction FunctionmemberCarol.N.Lee20 Apr '10 - 1:50 
I've learned the Back propagation learning algorithm.It must initialize input and output values.And the sample just realizes the learning process.I wanna save the learning results,then use the results to predict some unknown value.Could you give me some suggestions on realizing my idea?
GeneralTwo questions about test and usage.memberfrancois.piondrancy11 Jan '10 - 23:14 
First,
"Bravo" for this very clean library.
 
Then, two questions from a stupid programmer and mathematician like me :
 
1) For exemple on the "Perceptron classifier" sample :
Your sample allow to compute the parameter of the Network with a set of data.
But how to use the network in order to compute the class of one measure ? (how to use the network) ?
 
2) I need a Neuronal Network to classify "measures".
A record of my measures looks like a set of [time, sensor state(false/true)] elements.
For exemple :
RECORD 1
time (ms)...Sensor 1.........Sensor 2.......Class
-------------------------------------------------
0...........true.............false
20..........false............false
100.........false............true
120.........false............false..........1
 
RECORD 2
time (ms)...Sensor 1.........Sensor 2.......Class
-------------------------------------------------
0...........true.............false
20..........false............false
50..........true.............false
70..........false............false
100.........false............true
120.........false............false..........2
 
etc...
 
How can I use Neuronal Network to learn and to test these types of data ?
A sample will be like a cherry on a cookie...
 
Best Regards.
GeneralThis is fantastic!!!memberSandeep Aparajit7 Dec '09 - 4:24 
Greate Work!!
Thanks for such an elaborative info about neural nets.
 
Sandeep Aparajit
Mark usefull posts as Helpful/Answers.
My Blog | Photography

GeneralQueries about SOMmemberDaywalker21311 Jan '11 - 19:28 
Hi
I must say u have written very clean lib here.
I am also working on SOM and trying to count no of objects in an image..Can you guide me how I can do that using ur lib..?
GeneralTime Series Demo QuestionmemberAndrew Bennett8 Oct '09 - 6:06 
Hi Andrew,
 
Great work! A very interesting library. I have one question though; in your Time Series demo source, there's a magic number (0.85) that's fed into the network inputs and outputs and I just cannot see what it's doing there. What is it for?
 
Cheers,
Andy
GeneralRe: Time Series Demo QuestionmemberAndrew Kirillov8 Oct '09 - 23:22 
Hello,
 
OK, will try to clarify this a bit (however I think it was already discussed here). If we map time series values into [-1, 1] range (output range of sigmoid function), then it will work during training step. But if you start using the network for prediction then, it may not work well with some functions. It will work, for example, with sine, which does not go outside of the range. But if your function is growing? Network will be unable to predict future values, which are bigger than trained maximum. If you assign -1 to minimum value of the time series and 1 to maximum value, then you will never predict anything which is bigger than maximum and smaller than minimum – network just don’t produce values outside of sigmoid function’s range. So I did mapping into [-0.85, 0.85] range, leaving 0.15 range on each side, so network potentially could predict values bigger than trained maximum and smaller than trained minimum.
 
Also, I need to note that these applications are mostly just demos of how to use neural networks and the library I’ve made. Don’t need to try applying them for prediction of Forex data or some other stuff. In reality prediction tasks are much harder and more complex stuff is made for them.
 
A better way of prediction time series will be prediction of changes (delta), but not actual future values.
 
With best regards,
Andrew Kirillov
AForge.NET

GeneralRe: Time Series Demo Questionmemberh4ckm03d17 Jun '10 - 15:10 
So, the input data must be scaled before training.
GeneralMore than one threadmemberConstantable26 Sep '09 - 9:35 
Is it possible to run learning function of NN in more than one thread?
QuestionHow to program object recognition in C# by cameramemberzoro_mask18 Sep '09 - 22:03 
Hi Andrew Kirillov, I'm a newbie, I'm programming stock management application on Web. This application use camera to control input/output goods(container) and find empty position in stock to display on screen...all positions are put in order and all points in location are positioned in the form of rectangle. Could you help me recognize and find empty positions?
best regard
zoromask
GeneralTarget Tracking Correlationmembercentuit5 Sep '09 - 10:17 
Andrew,
 
Can I use Neural Networks to correlate targets ?
Meaning I have many sensors placed in different locations and they report target position, velocity, etc...however I want to report to the user a single target, since the sensors are reporting the same target. Can this be accomplished by using Neural Networks or you know of something better ?
 
Thanks
GeneralNeural networks in action. Problem with regional settings in your applications.memberSharkTime17 Aug '09 - 0:31 
Great article and software examples, thank you.
I had problems with data loading, in: Delta Rule Learning, Approximation (sample1), TimeSeries.
Probably, the reason is that you don't care about regional settings. In Poland we have ',' instead of '.' as decimal separator. Not 3.14 but 3,14.
 
I think that You may be interested in software:
 
Sharky Neural Network - Neural networks in action
 
For better understanding of neural networks.
SharkTime.com
GeneralSave/Load Network ro/fram a filememberhamidreza_buddy28 Jul '09 - 9:02 
Hello
I am using your ANN library for implementing a Speech Recognition system.
My problem is that i dont know how to save the trained network. because training a network is very time-consuming and i can not train it each time the program starts.
Is there any built-in method for doing so?
Thanks
GeneralRe: Save/Load Network ro/fram a filememberAndrew Kirillov28 Jul '09 - 10:14 
Hello,
 
Take updated version of the library from AForge.NET Framework project and use Save/Load methods.
 
With best regards,
Andrew Kirillov
AForge.NET

QuestionCan we use this library for fingerprint recognition?memberabelegreen21 Jul '09 - 20:10 
Hi Andrew! Thanks for your great article. Now I'm doing a project about recognition fingerprint with some Datamining's algorithms(Neural network,K-means,decision tree...).At first ,I'll do program with some available databases of fingerprint on internet. Do you have any experience about recognition fingerprint? Which library we can use? I hope to receive from you and the others useful advices. Thanks so lot.
AnswerRe: Can we use this library for fingerprint recognition?memberAndrew Kirillov21 Jul '09 - 22:26 
Hello,
 
abelegreen wrote:
Do you have any experience about recognition fingerprint?

Sorry, I don't have.
 
With best regards,
Andrew Kirillov
AForge.NET

GeneralNot determenistic behaviormemberAvihayE10 Jul '09 - 19:27 
Hello Andrey, first of all I want to thank you for this great library.
 
My question is - If I want my Neural Network to learn certain behavior, but in this behavior, for input X1, sometimes the output should be Y1, and sometimes Y2. Is it possible for a Neural Network to learn such behavior?
And if so, then how?
 

Thanks.
GeneralRe: Not determenistic behaviormemberAndrew Kirillov10 Jul '09 - 23:36 
Hello,
 
No, of course it is not possible. Neural network inside is nothing more but just a deterministic formula. In order to get what you want you need to add one more input, which takes random value - 0 or 1. And then you need to train your network to provide Y1 for {X1, 0} pattern and Y2 for {X1, 1} pattern.
 
With best regards,
Andrew Kirillov
AForge.NET

GeneralNeural networkmemberleila_6321 Jun '09 - 0:44 
Hi,I need matlab source code for traffic warning signs recognition.thanks for your helpConfused | :confused:
GeneralRe: Neural networkmemberAndrew Kirillov21 Jun '09 - 22:21 
So what ? Confused | :confused:
 
If you need it, you write it.
 
With best regards,
Andrew Kirillov
AForge.NET

GeneralMATLAB traingdx or traingda with adaptive learning rate and momentummemberMember 40706414 Jun '09 - 11:23 
Dear Andrew
Thanx so much of your great work.
for Image processing purpose and for classification I have 3 inputs and five class of outputs.
So I chose MLP with Back propagation and sigmoid function as activation function.
But the net is not trained to the desired error limit.
Have you checked the MATLAB traingdx or traingda algorithm?
It has an adaptive learning rate and momentum that successfully trained my network.
would you please check it out?
Regards.
Hamid Reza
GeneralHello . Basic email filtering engine using neural networksmemberstetcotm28 May '09 - 3:12 
Can you give me any advice in how could I implement a filtering engine, using your library, which classifies messages as either spam or not spam.
The training input/output sets are in the form of [word - number_of_aparitions_in_message].
 
I have to use multilayer arhitecture with backpropagation.
 
Thanks.
QuestionHow to step by step SAVE, LOAD and LOAD new data set for test network which was learned before? Helpmemberkamil pecio13 May '09 - 7:29 
Hi All,
I have problem with save and load network.I use AFORGE framework 2.0 so I have this method but I didn't know how to use it. First I write network.Save("network.dat"); after line
double error = teacher.RunEpoch(input, output) / samples; after that I want to Load network so I use Network.Load("network.dat"); before line: while ( !needToStop ) and I add checkbox on the form. When I checked it I have:
// run epoch of learning procedure
if (checkBox1.Checked == false)
{
double error = teacher.RunEpoch(input, output) / samples;
}
Please help me step by step how to save load network and how to load new data for test learned network. It will be great and save me a lot of time.
Best regards
Kamil
GeneralThank you so much for your work!memberTeufel12127 May '09 - 7:30 
Thank you so much for your work!
 
http://arachnode.net
GeneralProbability Neural Networkmembercaksabre228 Apr '09 - 5:52 
Hi,
 
Great article, has been a big help. I do have a question though, as an example say I had a coin toss but the coin was unfairly weighted. And I have 1000 occurances of this coin toss with certain input values (position of coin, person tossing, etc.) and the outcome of the toss. What I want to build is a system that taking these inputs can give me the probability of it being heads based on the inputs provided. What type of network would you recommend, and how can I output probability rather than just yes it will be heads.
 
Thanks,
 
Chris
GeneralThank youmemberdizhuang12 Apr '09 - 3:01 
I am a leaner from China.
Long times ago when I began to learn the ANN ,I write a program using C# ,however it never worked ,I donot know why. You know the basic principle of ANN is very common.So ,I decide to read your codes ,then consult some things from you.
My English is poor ,so please ^_^
Your work is great 3Q. Big Grin | :-D
QuestionClasifing grayscale 20x20 imagesmemberWhatEverMD24 Feb '09 - 23:33 
First of all thank you for the article and thank you for nice framework.
I have a quesetion about using the framwork for classification tasks.
 
Suppose we have 3 classes of 20x20 gray scale images: traingles, squares and circles.
 
I have created a simple BProp NNet with following params:
 
Activation func: Unipolar sigmoid.
Input layer:400 neurons.
Hidden layer: tried from 3 to 100 neurons.
Output: 3 neurons.
 
Alpha value: from 0.001 to 10.
Learining rate: from 0.001 to 10.
Momentum: from 0.001 to 2.
Training epochs: from 100 to 1000.
 
Input samples: from 3 samples to 18 samples (3 objects, 6 samples each)
All inputs are normalized to [0,1].
 
The problem:
The net doesn't learn at all. The Error stays the same during the training.
The only thing I have noticed, is that the starting level of error decreases
when the alpha value gets very small.
 
May be I am missing something? Could you please point me to right direction.
Thank You.
Serghey Bleih.
AnswerRe: Clasifing grayscale 20x20 imagesmemberAndrew Kirillov24 Feb '09 - 23:45 
Hello,
 
Just a quick idea ... Try bipolar sigmoid function and inputs in the range [-1, 1].
 
Also ... What are your desired outputs (range, etc.)? You've said nothing about it.
 
With best regards,
Andrew Kirillov
AForge.NET

GeneralRe: Clasifing grayscale 20x20 imagesmemberWhatEverMD25 Feb '09 - 0:17 
Thank you for answering so quickly. Smile | :)
 
The desired outputs are:
0 0 1 for first object (let it be triangle).
0 1 0 for second object (square).
1 0 0 for third object (circle).
 
Where each collumn represent the neuron in output layer.
GeneralRe: Clasifing grayscale 20x20 imagesmemberAndrew Kirillov25 Feb '09 - 0:24 
OK, try with bipolar function, inputs and outputs and then we'll see.
 
With best regards,
Andrew Kirillov
AForge.NET

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

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 19 Nov 2006
Article Copyright 2006 by Andrew Kirillov
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid