4.7. How to use the described neural network?

advertisement
4.7. How to use the described neural network?
(Translated by Krzysztof Kajdański; krzysiek.kajdanski@wp.pl)
As I have mentioned before, the program presented previously, assumes that network has
three outputs associated with the recognition of the three kinds of objects (animals):
mammals, birds and fish. Because a network is single-layered – it means that it contains only
these three neurons, although you will learn in the future about networks in which the number
of the neurons is much more higher than the number of outputs. Thanks to the simple
construction of the network it is very easy to reconstruct it to any number of the outputs.
You enter the input – in our example – only five signals, corresponding to some features of
recognizing objects. Obviously you can increase this number in a trivial way, if in your
problem that you would like to solve with the network, there is a greater amount of the input
data. All input signals are connected to every neuron, according to 'the lazy rule' – if you don't
feel like thinking which input signal influences which output signal – it is the best choice to
connect everything to everything else. In practice of neural networks you usually do so, so it
is the best for you to get use to this convention.
It would be good, if you thought a little bit, before entering the input signals. Amongst them
there are ones containing numeric information (info about how many legs animal have) or
Boolean information (info concerning if an animal lives in water or flies, if is covered with
feathers, or is viviparous). You need to consider in what way you will represent logical values
in a network, because neurons operate – as I have mentioned previously – on values of the
signals, not on a symbols (just like true or false). Because it is not easy – let me share a
reflection.
If you are an computer scientist (as I suspect you may be, as you are interested in neural
networks) you may suspect that the idea of true and false can be expressed in binary form: 1
as for true, 0 as for false. And if you are the a Great Computer Scientist, especially from that
kind that use Assembler, have dreams about microprocessor registry, hexadecimal memory
records and Java applets – then that kind of relation is obvious, total and the only right.
Hmmm...
I have something to confess. Entering in the reign of the neural networks will make you
modify your habits. Here is where you have to do with it for the first time, but not for the last.
Remember then that zero in neural network is quite a stupid signal to transfer (one from this
kind which is absent, that means it brings no new information). It is due to way neurons
work, multiplying signals by weights and then summing it – multiplying by zero results
always in the same way – independently on the value of neuron, which represents the inner
knowledge of a neuron!
Deciding on using zero as an input signal you deprive yourself of some possibilities of
influencing on the network behavior, which is not smart or necessary. That is why in my
program I use convention, to using which I encourage you: true marked with +1 signal and
false with -1. Such bipolar signals are the best in fulfilling their tasks.
Additional advantage of a bipolar neural network is a possibility of using any values of input
signals during inputting the data, and that may reflect the convictions of a person using a
network about an importance of some messages. When inserting data for a cod you can
consider as crucial the fact that it lives in water and input +2 instead of +1 (you can interpret
that as a yell 'of course, it does!' instead of calm 'yeah, it's true'), and for other cases you can
input values smaller than one (for instance – for flying fish and the question 'can it fly?' you
may doubt if you should answer +1, as for an eagle – in that case you can put uncertain and
full of doubts +0.2, which may be interpreted as 'sort of...'). There's a lot more of possibilities,
for example signal corresponding to question 'has tail' for snake should be of value '+10'
('only!' :-) ).
Since you know how to input network input signals – try to perform a few simple experiments
with me. Input data for a few randomly chosen animals and check if the network recognizes
them correctly. You can notice that in network consisting of many elements, the
normalization of the input signals (caring if they have the same signal 'strength') is not as
crucial. You will get to know that, by giving input values – for instance for a fox:

4 (legs),

-1 (doesn't live in water),

-1 (doesn't fly),

-0,9 (not covered with feathers - unless it just caught a goose...),

-1 (viviparous);
as the values

8 (has 4 legs, but it is so important that it is worth to be counted twice),

-6 (hates water, especially in barrels hidden in the ground!),

-3 (absolutely doesn't fly, even if it wished to sometimes...),

-5 (ginger fur is an important feature),

-9 (doesn't lay eggs and doesn't tolerate similar suspicions!).
During the testing of the program it is good to notice that it can not only recognize correctly
typical situations (it will classify properly every mammal, fish and bird – see pictures 4.18
4.19. 4.20), but it acts quite well in strange situations – for instance it will recognize as a
mammal a seal, a bat or even a platypus (it is a weird mammal from Australia – it hatches
from eggs), and as a bird – a non flying ostrich for instance. (Even a flying fish is recognized
with no failure!) Try it out!
1.
2.
Fig. 4.18 Recognizing a typical mammal using the network.
3.
4.
Fig. 4.19. The work of the program during the bird identification.
5.
6.
Fig. 4.20. The work of the program during the fish recognition.
However it will be puzzled if we show it a snake (it has got no legs, lives on a ground and
hatches from eggs???). Then every neuron disgusted announces that something like that isn't a
decent animal (every output is negative), which, in context of our rules of classification,
makes sense.
Described network is very primitive and makes sometimes mistakes, for instance repeatedly
recognizes turtle as a mammal (it has 4 legs, lives on a land, but hatches from eggs, so there
should be some doubts....), or even considers lungfish as mammals (they live during drought
on a land – please check it, if you don't believe me) – but that is how it is with the neural
networks – they can be wrong in such a nice way – if any of you haven't made ever a mistake
– let him throw the stone at the monitor first!
Download