C++ Neural Networks and Fuzzy Logic
by Valluru B. Rao
MTBooks, IDG Books Worldwide, Inc.
ISBN: 1558515526 Pub Date: 06/01/95
Previous Table of Contents Next
To see the outputs of all the patterns, we need to copy the training.dat file to the test.dat file and rerun the
simulator in Test mode. Remember to delete the expected output field once you copy the file.
Running the simulator in Test mode (0) shows the following result in the output.dat file:
for input vector:
0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000
0.000000 1.000000 0.000000 1.000000 0.000000 0.000000 0.000000
1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 1.000000
1.000000 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000
0.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000
output vector is:
0.005010 0.002405 0.000141
−−−−−−−−−−−
for input vector:
1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 1.000000
0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000
0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000
1.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000
output vector is:
0.001230 0.997844 0.000663
−−−−−−−−−−−
for input vector:
1.000000 0.000000 0.000000 0.000000 1.000000 1.000000 0.000000
0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 0.000000
1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
0.000000 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000
0.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000
output vector is:
0.995348 0.000253 0.002677
−−−−−−−−−−−
for input vector:
1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.000000
0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 0.000000
1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
0.000000 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000
0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
output vector is:
0.999966 0.000982 0.997594
−−−−−−−−−−−
for input vector:
0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000
1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000
0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000
output vector is:
0.999637 0.998721 0.999330
−−−−−−−−−−−
C++ Neural Networks and Fuzzy Logic:Preface
Chapter 13 Backpropagation II
261
The training patterns are learned very well. If a smaller tolerance is used, it would be possible to complete the
learning in fewer cycles. What happens if we present a foreign character to the network? Let us create a new
test.dat file with two entries for the letters M and J, as follows:
1 0 0 0 1 1 1 0 1 1 1 0 1 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1
0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0
1 0 0 0 1
0 1 1 1 1
The results should show each foreign character in the category closest to it. The middle layer of the network
acts as a feature detector. Since we specified five neurons, we have given the network the freedom to define
five features in the input training set to use to categorize inputs. The results in the output.dat file are shown as
follows.
for input vector:
1.000000 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000
0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 0.000000
1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 1.000000
0.000000 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000
0.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1.000000
output vector is:
0.963513 0.000800 0.001231
−−−−−−−−−−−
for input vector:
0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000
1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000
0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
0.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000
output vector is:
0.999469 0.996339 0.999157
−−−−−−−−−−−
In the first pattern, an M is categorized as an H, whereas in the second pattern, a J is categorized as an I, as
expected. The case of the first pattern seems reasonable since the H and M share many pixels in common.
Do'stlaringiz bilan baham: |