Attrasoftfor Windows 95/98 Version 4.0 (7/1999) |
||||||||||
|
All Attrasoft products are Y2K Compliant! 5. Examples
There are five character recognition problems: 5 by 7 character recognition Figure 9. Example Menu. The parameters are: Projects 5x7
8x8 19x19(1023)
32x32
Below, we will discuss the 19x19 project with 1,023 and 4,095 classes. There is a problem here, not for PolyNet, but for the users: nobody can learn and memorize 1,000 characters in a few seconds. This turns out not to be a problem; we can introduce a mathematical way to generate the characters. By looking at a character, you can calculate its classification instead of memorize them. The command "Decimal/1N1C Classification" is fast than the command "Decimal/Classification". Please use "Decimal/1N1C Classification" for this section. We get a hint of generating these characters from a digital watch: all digits can be generated from the following frame: 11111111
The above pattern is an '8'. The above frame will generate 127 patterns. Some of them are not distinguishable; for example, you can find six '1' in the above frame ( Left 1, Right 1, Left up 1, Left bottom 1, Right up 1, and Right bottom 1). There are seven line segments, called A, B, C, D, E, F, G: A
Each character can be represented by a seven-bit string: gfedcba. For example, 0000001 means that segment A is present, the rest are not there;
These characters are ordered by binary numbers from 0000001 to 1111111, given 127 classes. To generate more characters, a larger frame has to be used. We will choose the following frame: 11111111 11111111
There are 12 line segments, giving more than 4000 patterns. 5.1.2 19x19 Character Recognition (1,023 Classes) The 1,023 characters are generated by the following basic lattice: 11111111 11111111
There are 12 line segments in the lattice. Depending on whether these line segments are there or not, we can generate about 4,000 characters. The line segments are labeled by A, B, C, ... L as follows: A
H
Each character can be represented by a 12-bit string: lkjihgfedcba. For example, 00000 00000 01 means segment A is present; the rest are not there;
These characters are ordered by binary numbers from 00000 00000 01 to 1111 11111 11, giving 4,095 classes. In the following, the line-segments K and L will not be used. These line-segments are basically straight lines with 8 bits. In the above frame, segments A, C, G, . . . look alike. To distinguish the line segments, we will add an extra bit to these lines. The definitions of these line segments are: A: 11111111
C:
1
G: 1
-------------------------------------------- H: 11111111
J: 1
-------------------------------------------- B: 11
D 11
E: 1
The definition of the rest of the line-segments can be found in the training file. The training, and recognition files are generated by clicking: "Example/19x19 character". This command will take a few seconds. The class assignment for each character depends on the value of the binary string. For example, 00000 00000 01 is class 1;
The formula to calculate class is: class = A + B*2 + C*4 + D*8 + E* 16 + F*32 + G* 64 + H* 128 + I*256 + J * 512 The above formula means: If line segment A is in the character, add 1, else add 0;
Example Several artificial characters are given below: Class 1: 11111111
Class 4
1
-------------------------------------------- Class 128:
1
-------------------------------------------- Class 256 11111111
-------------------------------------------- Class 3 (Two segments, A and B, form class 3): 11111111
-------------------------------------------- Class 7: 11111111
The training file contains all 1,023 classes. The neural net is organized accordingly: there are 1,026 class-neurons and 19 * 19 = 361 pattern-neurons, giving a total of 1,026 + 361 = 1,387 neurons. The reason to choose 1,026 neurons instead of 1,023 is that the output-vector will be printed 19-digits per line and 1,387 neurons fit into 73 lines. The training file has the 1,023 classes. The training time is about 5 seconds (400 MHz Pentium). PolyNet will randomly generate a few characters with some noise and ask the net to recognize it. The 1N1C recognition time is 1- 1.5 second per character (400 MHz Pentium). The recognition rate is 100%. You can regenerate other recognition files by clicking "Examples/19x19 Character recognition" again. Note, a neural network can learn 1,000 characters in 5 seconds, faster than the human brain. You can argue these characters are special, but we choose them because it is easy for humans. It does not make any difference to PolyNet as to what set of characters are used. Try it and you will convince yourself. 5.1.3 32 by 32 Character Recognition There are 127 classes: class = A + B*2 + C*4 + D*8 + E*16 + F*32 + G*64. There are 127 classes. The neural net is organized accordingly: there are 128 class-neurons and 32 * 32 = 1,024 pattern-vector, giving a total of 1,024 + 128 = 1,152 neurons. The reason to choose 128 class-neurons instead of 127 is that the output-vector will be printed 32-digits per line and 1,152 neurons fit into 36 lines. The training file has the 127 classes. PolyNet will randomly generate a few characters and asks the net to recognize it. The recognition rate is 100%. You can regenerate other recognition files by clicking "Examples/32x32 Character recognition" again. 5.1.4 19x19 Character Recognition (4,095 classes) This is the same as problem as the earlier 19x19 problem, however, the number of classes is increased to 4,095. Note here, a neural network can learn 4,000 characters in 20 seconds, faster than the human brains. You can argue these characters are special, but we choose them because it is easy for humans. It does not make any difference to PolyNet as to what set of characters are used. 5.1.5 50x50 and 100x100 Image Recognition Attrasoft provides many software for jpg/gif image recognition. They are:
To run the 50x50 example, click "Example/50 by 50 Binary Image Recognition". The data files are img50x50.trn and img50x50.rec. Images of a face, a rabbit, a boat, . . . are used to train the neural net. Users can add their own data to the end of the data files. Make sure you check the data file format before running. To check the format, click "Data/Test". To run the 100x100 example, click "Example/100 by 100 Binary Image Recognition". The data files are img100x100.trn and img100x100.rec. Users can add their own data to the end of the data files. Make sure you check the data file format before running. To check the format, click "Data/Test". All you do to solve a shifter-problem is to click a few buttons; however, first we will explain the problem. The shifter problem generates a pattern, shifts the pattern in one of many possible ways and asks a neural network to identify the shifting. This is obviously synthetic data instead of real data, such as a person's signature. The shifter problem is chosen because: (1) the number of neurons is arbitrary, allowing you to work with many
different sizes of neural networks;
Example 4-digit Shifter problem. Four possible movements are listed as follows: Class: Pattern:
Comment
This shifter has 27 classes: 100, 200, 300, ... 010, 020, 030, ..., 001, 002, ..., 009. When you shift a pattern once, it is a single shifter; when you shift a pattern twice, it is a double shifter. Shifter data is used to train the neural network. Once training is finished, the network has to solve two types of problems: identify a shift or complete a shift. To generate training data from PolyNet, click: Example/Shifter/Data. This command will also open the training and recognition files and set up the neural network. The default values (for the shifter problem) are: 15-digit Shifter (33 neurons),To change the default settings, click: Example/Shifter/Parameter.Example. A 15-Digit Shifter's training file is: *
33 010 000001000000010
700 777707707070700
In the first training pattern, 010 means no shift;Use the command "Data/Symmetry" to read or set the symmetry parameters. In this problem, it indicates that the shifter has a 1-dimensional x-translation symmetry. This is very important for training the network. Now that the network is initialized and the data is generated, it is ready to be trained and tested. Click 'C'-Button (Classification). This command takes no time. If you click 'D'-button (Distribution), the Boltzmann Machine will present you with a distribution, which is a set of possibilities and the probability for each possibility. The one with the largest number is the preferred answer. The following is an example of the output for a shifter problem: xxx
The recognition pattern is printed first. This is followed by all possible solutions and a relative probability for each possibility. Finally, 001 ( Right Shift ) is the answer and it will be printed again with the original input data. The probabilities printed next to each possibility are relative probabilities. In the first example, the probabilities for 100, 010, and 001 are 2/52, 0, and 50/52, respectively. The probabilities are not normalized because they carry other information: the larger the number is, the more reliable the answer is. In this example, 40 or so recognition-patterns are recognized. If you are satisfied, copy the unrecognized patterns to the training file and run again (with xxx being replaced properly). Then you should get 100% correct classification. Alternatively, generate more training data by clicking: Example/Shifter/Parameter,and increase the number of training patterns. Click commands "Decimal/Classification" or "Decimal/Distribution", you can expect three possibilities for each recognition pattern: Correct classification: this is usually the case when the Boltzmann Machine assigns one predominate probability to one of the output possibilities.
If you shift a pattern twice, you will get a double shifter. Here are two examples: 010001
The possible shifts are: LL 100100
Where RL means Right-Left shifts. A recognition pattern looks like this: xxxxxx
The output data file for "Decimal/Distribution" looks like this: xxxxxx
The output data file contains the original vector, plus several possible shifts. Finally, the answer is printed. Each possibility is associated with a number: for class 100100, the number is 260;
The predominate number here is 260, making the preferred answer 100100 (the left-left shift), which is the correct answer. These numbers are relative probabilities. Note, the probabilities printed next to each possibility are relative probabilities. The probabilities are not normalized because they carry other information: the larger the number is, the more reliable the answer is. 1. Sources: M. Olave, V. Rajkovic, M. Bohanec: An application for admission in public school systems. In (I. Th. M. Snellen and W. B. H. J. van de Donk and J.-P. Baquiast, editors) Expert Systems in Public Administration, pages 145-160. Elsevier Science Publishers (North Holland), 1989. 2. Information Number of Instances: 12960 (instances completely cover the attribute space)
------------------------------------------------- not_recom 4320 (33.333 %) recommend 2 ( 0.015 %) very_recom 328 ( 2.531 %) priority 4266 (32.917 %) spec_prior 4044 (31.204 %) 3. Attribute Values: parents
usual(0), pretentious(1), great_pret(2)
recommend (4) very_recom (3) priority (2) spec_prior (1) The last 20 rows will be used for the recognition file. Below are the first 10 instances: 0 0 0 1 0 0 0 0 4
Below are the last 20 rows: 2 4 3 5 1 1 2 1 x
The correct answers are 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5. 5. Results Click 'C'-button and get: ================= Beginning ================== 24351121x
24351122x
24352000x
... ... =================== End ========================== 6. Analysis The correct answers are 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5. The predicted answers are: 1, 5, 2, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5. 95% predictions are correct, the other 5% are very close (1 was identified
as 2).
5.4 Mathematical Probabilities and Functions All files used in this section are in your software package. Let a mapping
be defined by:
y1 = ( x1 + x2 + x3 ) Mod 7;
9999 instances; 3675 classes. 9999 rows can generated in this way: 1 0 0 0 0
1 1 0 1 0
The 9999 rows of data are divided into two parts: the first 9994 rows will be used for training; and the last five rows will be used for testing. The last 5 rows are: Input Output 6 6 1 3 1
6 6 1 4 0
To run this problem: Click 'C'-button. 66131xxxxx
66140xxxxx
... Predicted correct Answer 6 6 1 1 0
6 6 1 4 0
The prediction is very close to the correct answers. There is another mathematics function problem in the PolyNet. Let a 3-variable function be defined by: y1 = ( x1 + x2 + x3 ) Mod 7;
We will generate the data as follows: assume initially that (x1, x2, x3) is in state (1 0 0), then it will generate (1 1 0). Now we will use (x1, x2, x3) = (1 1 0) and it will generate (2 1 1), ... ... The parameters of this problem are:
Online Order
or if you prefer, Online Fax order:
Mail Order: $129.99 (S&H included) PolyNet 4.0
Send questions or comments to: webmaster@attrasoft.comor contact us at: Attrasoft, P. O. Box 13051, Savannah, GA. 31406, USA Copyright © 1998 Attrasoft, Inc. All rights reserved. |