C++ Neural Networks and Fuzzy Logic: Preface


Compiling and Running the Backpropagation Simulator



Download 1,14 Mb.
Pdf ko'rish
bet177/443
Sana29.12.2021
Hajmi1,14 Mb.
#77367
1   ...   173   174   175   176   177   178   179   180   ...   443
Bog'liq
C neural networks and fuzzy logic

Compiling and Running the Backpropagation Simulator

Compiling the backprop.cpp file will compile the simulator since layer.cpp is included in backprop.cpp. To

run the simulator, once you have created an executable (using 80X87 floating point hardware if available),

you type in backprop and see the following screen (user input in italic):

C++ Neural Networks and Fuzzy Logic

       Backpropagation simulator

               version 1

Please enter 1 for TRAINING on, or 0 for off:

Use training to change weights according to your

expected outputs. Your training.dat file should contain

a set of inputs and expected outputs. The number of

inputs determines the size of the first (input) layer

while the number of outputs determines the size of the

last (output) layer :



1

−> Training mode is *ON*. weights will be saved

in the file weights.dat at the end of the

current set of input (training) data

 Please enter in the error_tolerance

 −− between 0.001 to 100.0, try 0.1 to start −−

and the learning_parameter, beta

C++ Neural Networks and Fuzzy Logic:Preface

C++ Classes and Class Hierarchy

148



 −− between 0.01 to 1.0, try 0.5 to start −−

 separate entries by a space

 example: 0.1 0.5 sets defaults mentioned :

0.2 0.25

Please enter the maximum cycles for the simulation

A cycle is one pass through the data set.

Try a value of 10 to start with

Please enter in the number of layers for your network.

You can have a minimum of three to a maximum of five.

three implies one hidden layer; five implies three hidden layers:

3

Enter in the layer sizes separated by spaces.

For a network with three neurons in the input layer,

two neurons in a hidden layer, and four neurons in the

output layer, you would enter: 3 2 4.

You can have up to three hidden layers for five maximum entries :



2 2 1

1        0.353248

2        0.352684

3        0.352113

4        0.351536

5        0.350954

...

299      0.0582381



300      0.0577085

−−−−−−−−−−−−−−−−−−−−−−−−

         done:   results in file output.dat

                 training: last vector only

                 not training: full cycle

                 weights saved in file weights.dat

−−>average error per cycle = 0.20268 <−−

−−>error last cycle = 0.0577085 <−−

−>error last cycle per pattern= 0.0577085 <−−

−−−−−−>total cycles = 300 <−−

−−−−−−>total patterns = 300 <−−

The cycle number and the average error per pattern is displayed as the simulation progresses

(not all values shown). You can monitor this to make sure the simulator is converging on a

solution. If the error does not seem to decrease beyond a certain point, but instead drifts or

blows up, then you should start the simulator again with a new starting point defined by the

random weights initializer. Also, you could try decreasing the size of the learning rate

parameter. Learning may be slower, but this may allow a better minimum to be found.

This example shows just one pattern in the training set with two inputs and one output. The results along with

the (one) last pattern are shown as follows from the file output.dat:

for input vector:

0.400000  −0.400000

output vector is:

0.842291

C++ Neural Networks and Fuzzy Logic:Preface

C++ Classes and Class Hierarchy

149



expected output vector is:

0.900000


The match is pretty good, as can be expected, since the optimization is easy for the network; there is only one

pattern to worry about. Let’s look at the final set of weights for this simulation in weights.dat. These weights

were obtained by updating the weights for 300 cycles with the learning law:

     1 0.175039 0.435039

     1 −1.319244 −0.559244

     2 0.358281

     2 2.421172

We’ll leave the backpropagation simulator for now and return to it in a later chapter for further exploration.

You can experiment a number of different ways with the simulator:


Download 1,14 Mb.

Do'stlaringiz bilan baham:
1   ...   173   174   175   176   177   178   179   180   ...   443




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish