Rapid Development Neural Network Based on JOONE
I. Introduction of neural networks, since the 1970s, with the continuous development of computer technology, the theory and practice of artificial neural network (ANN) have been rapidly improved. The concept of ANN is derived from Biological Neural Networks (BNN). Limited to the current theory and technology, Ann retains the basic structure of the brain neural network, reflects the working principle of the brain nervous system. In an ANN, the information stored in the connection is stored on the connection, and the external stimulus automatically activates the corresponding neurons through the connection channel to achieve the purpose of automatic identification. Thus, it is a system with a completely different modern computer. Ann simulates some structures and functions of neural networks in organisms, and in turn is used in engineering or other fields.
two. About Joone
Joone (Java Object Oriented Neural Network) is an open source project that quickly develops neural networks in Java languages. Joone supports a lot of features, such as multi-threaded and distributed calculations, which means that Joo You can use multiprocessor or multi-computer to balance the attachment.
Joo has three large modules: Joone-Engine: Joo's core module.
Joone-Editor: Joo's GUI development environment. Neural network models are established without writing a line of code, and training and verification can be trained. An example of establishing a XOR network model with Joone-Editor is provided in Joone. The neural network in this article is referred to in this example.
Joone-Distributed-Environment: Joo is used to support distributed computing modules.
This article uses Joone-Editor to establish a neural network for pattern identification, training, and then used to identify users' input in a Java Applet program.
three. Use Joone to quickly establish neural network
Figure 1. A simple neural network Figure 2. Expression in Joone
Figure 1 is a simple neural network that uses Layer in JOONE to represent all nodes of each layer, with Synapse to encapsulate the connection between the layer and the layers. This is the corresponding Java code: // Establish three Sigmoid node layers and two full connections.
Sigmoidlayer Layer1 = new sigmoidlayer ();
Sigmoidlayer Layer2 = new sigmoidlayer ();
Sigmoidlayer Layer3 = new sygmoidlayer ();
Fullsynapse synapse1 = new fullsynapse ();
Fullsynapse synapse2 = new fullsynapse ();
// Set the number of nodes in each layer
Layer1.seRows (3);
Layer2.seRows (3);
Layer3.setrows (3);
// connect the layers
Layer1.addoutputSynapse (SYNAPSE1);
Layer2.addinputSynapse (SYNAPSE1);
Layer2.addoutputSynapse (SYNAPSE2);
Layer3.AddinputSynapse (SYNAPSE2);
In this way, a simple neural network model is built, Joone will automatically set the weight coefficient of the connection. Of course, this network has not yet trained, there is no practical function. The neural network identified by JOONE will be established in Joo. You can also quickly establish a neural network with Joone-Editor on a visual interface. The following figure is a neural network model for solving or problematic in Jooone-Editor:
Figure 4. Model in Joone-Editor
four.
Figure 5. Identification
Establish a model identification neural network
[1] program description
This program is a neural network that implements a simple pattern identification. The user wrote the letter in the discipline to identify and display by the program. The user draws letters in a 10x12 area, click the [Identification] button to identify the graphics input by the user. The input of the neural network corresponding to the current image is displayed in the top right, and the lower right is the output and identification result of the neural network. In Figure 5, the user entered A and the program made the correct recognition. [2] Establish a neural network model with Joone-Editor
Open Joo-Editor, create a new neural network, as shown in the figure:
The main components of the neural network of the program are:
l 120 input layers composed of input nodes
l consisting of 8 nodes
l The output layer consisting of 4 nodes
l A Joo's own training layer and two file input layers to enter test data and expectations.
[3] Training Neural Network
First, the training data is obtained by writing. Draw letters in the 12x10 input frame of the Java program, the text box in the upper right corner generates a one-dimensional integer array of the corresponding size as input data, separated by a semicolon. Each input is a separate line. Since this program is to distinguish between A, B, C, D four letters, the expected value is an array of length 4. It is now specified that A corresponds to "1; 0; 0; 0", B corresponds to "0; 1; 0; 0", C is "0; 0; 1; 0", D is "0; 0; 0; 1" And add these results to the back of the corresponding input data. Setting the input file as the data file just established in two fileInput, and set training data from Chain 1 to 120, the training data is 124 lines from Chapter 121.
Open the control panel, set the learning rate of 0.7, and use the 35 records used to train 10,000 times. Click [RUN] to start training. The progress and convergence of the training will be displayed on the control panel. When it is 400 times, the error of the system is already small (0.00260), you can click on Pause to stop training. If the weight parameters choose unreasonable, it is possible that the network cannot converge. At this time, you can choose [Control] -> [randomize], re-randomly generate the initial weight coefficient.
Figure 7. Training Control Panel
[4] Transplant the neural network completed into the program
In order to use a well-trained neural network in the program, you can use Java's serialization to output the network to the file and then read this file in the program, reactivate the neural network object. Select [File] -> [Export Neural NEURALNET ...] to save the current neural network to the file. Then you can use it in the program.
Below is the code to read the neural network from the file:
ObjectInputStream Ois = New ObjectInputStream (New FileInputStream ("D: /Work/Homework/ann/final/3.snet");
Object o = ois.readObject ();
System.out.println ("o is" o);
Ois.Close ();
NEURALNET NET = (NeuralNet) O;
Then you can use it in the program. Each user-drawn data is converted to a one-dimensional array of 120 as an input, and then the neural network is calculated and outputs a vector of 4 as an output.
Fives. test
Draw 9 times A, B, C, and 8 times DCed 35 records as input data, training 10,000 times, then output neural networks. Use this neural network to identify, finding inputs similar to training data, the identification accuracy is high, but the difference between and the original training data is different, the program may occur. In order to improve the accuracy, you need to increase the number of samples and coverage. six. Advanced features
Joone has a lot of advanced features. It supports various processing layers (Linear, Sigmoid, Tanh, Logarithmic, Context, DELAY, NESTED), a variety of connection modes, and a series of tools and Script language. To help process data and analysis results. Flexible use Joone, can quickly develop a variety of neural networks.
Seven. Reference and related resources
[1] Neural Network Introduction - Learning Andrew Blais, Ph.D. (Onlymice@gnosis.cx), David Mertz, Ph.D. (Mertz@gnosis.cx), David Mertz, Ph.D. (mertz@gnosis.cx), Gnosis Software, Inc. (mertz@gnosis.cx). June 2001 http://www-900.ibm.com/developerWorks/cn/linux/other/l-neural/index.shtml
[2] Artificial Intelligent Ditch Exymnado Shi Tian Heng Science Press February 2003
[3] JOONE Home http://sourceforge.net/projects/joone
[4] At the same time attached to the Java source program and the well-trained neural network in this article