Neural networks – How to train an example

To continue studying the workings of neural networks and to discover curiosities about them, ai-junkie contains some very interesting information. Indeed, by accessing the download link it provides you can download a package with which to check the training and operation of neural networks.

In this case the author of the code poses the following problem: How to enable a series of minesweepers to find mines without specifically programming them for this.

To resolve this, the following method is proposed: Each minesweeper will be an independent neural network. The network is designed so that its input is the location of the nearest mine and as output it generates the acceleration of the left and right wheels, which determine the trajectory and speed of the mine sweepers. So from the location of the nearest mine, the network is expected to control the movement of the minesweepers.

Having established the type of neuron and the diagram that links them, it only remains to determine the learning method to be used. Among the known possibilities the author proposes randomly starting each minesweeper and letting it run for a certain time (generation). Throughout this interval some minesweepers will collect more mines and others less. At the end of the execution some genetic recombination techniques are applied: Those subjects that swept most mines were selected, their neural networks being recombined like genes and chromosomes during a reproduction process and the execution is started again. This is an example of neural networks with genetic training. Having selected and recombined those most successful individuals we expect each generation to be more effective than the previous one. The process is repeated until the expected result is obtained.

The compressed download package includes the executable “smart_sweepers.exe”. When you launch it a window appears where you can see the mines (green dots) and the minesweepers moving randomly through the window (no predefined rules have been created). The “generation” title tells us how many genetic recombinations have been carried out so far. It is advisable to leave the programme running for at least an hour and then check the new operation of the minesweeper. The results are even more significant between 8 and 10 hours later.

IMAGE: Screenshot of Smart Sweepers v1.0

It can be observed, therefore, that in the implementation of systems based on neural networks it is, in many cases, more important how we teach the system and how we evaluate its learning capacity than its actual architecture. Systems such as minesweepers or those employed in the automatic processing of documents are initiated randomly and are provided with learning tools based on genetic rules so that they end up doing very specific tasks. Their strength lies in the great specificity capacity that these methods can develop autonomously.