4.6. How to construct a simple linear neural network?

advertisement
4.6. How to construct a simple linear neural network?
(Translated by Krzysztof Kajdański; krzysiek.kajdanski@wp.pl)
I'll show you another simple program. This program named Example 02 will help you start a
simple play with a very small neural network. I encourage you though to write by yourself a
more complicated program solving one of your real problems.
Network described in the Example 02 program recognizes animals. There are three categories
of the animals (a mammal, fish, a bird) and therefore network contains only three neurons.
Recognitions are made basing on five features, that make every neuron to have five inputs. On
these inputs we send the following information:
 how many legs does animal have,
 does animal live in water, can it fly,
 is it covered with feather,
 does it hatch from an egg.
For every neuron I set the values of weights in such a way to match the pattern of an
appropriate animal. Neuron number one, which is supposed to recognize a mammal has the
following weight values set:

4 = mammal has 4 legs,

0.01
= mammal sometimes lives in water (seal), but it is not typical for it

0.01
= mammal sometimes flies (bat), but it is not typical for it

-1 = mammal has no feathers

-1.5
= mammal is viviparous and it is a major feature of it
The weights of the neuron number two recognizing a bird are set in the following way:

2 = birds has two legs,

-1

2 = a bird usually – which is important to it – can fly (exception: ostrich),

2.5
= a bird has feathers and it is a major feature of it,

2
= a bird hatches from eggs.
= a bird doesn't live in water (a duck only swims on a surface!),
The weights of the third neuron identifying fish are set in the following way:

-1

3.5

0.01
= fish generally cannot fly (there are flying fish!),

-2
= fish is never covered with feathers or nothing that resembles them
= fish has no legs
= fish lives in water and it is a major feature of it
 1.5 = fish generally hatches from egg, which is not as important as in bird case,
because there are exceptions (viviparous fish);
Program after start prints out on a screen information about previously described weights for
every input of every neuron (Fig. 4.17) and allows to perform quite amusing experiments,
which I describe in the following sub-chapter.
Fig. 4.17. The beginning of the work of the Example02 program
Download