aboutsummaryrefslogtreecommitdiff
path: root/examples/ann_som
diff options
context:
space:
mode:
authorB. Bogart <bbogart@users.sourceforge.net>2009-08-12 17:06:48 +0000
committerB. Bogart <bbogart@users.sourceforge.net>2009-08-12 17:06:48 +0000
commit927491ef0d6443f732a65aa4d1da57f670c06d49 (patch)
tree66ae7d6466a99009cc6337fd4ebe62026a293912 /examples/ann_som
parent96e64c192a846ee621f43c1f1c8a61a38683956e (diff)
Changed "example" (this should be a help-file?) to reflect addition of
"rinit" method to set weights to time-seeded random values. svn path=/trunk/externals/ann/; revision=11900
Diffstat (limited to 'examples/ann_som')
-rw-r--r--examples/ann_som/ann_som.pd138
1 files changed, 84 insertions, 54 deletions
diff --git a/examples/ann_som/ann_som.pd b/examples/ann_som/ann_som.pd
index 9f03979..3d471ed 100644
--- a/examples/ann_som/ann_som.pd
+++ b/examples/ann_som/ann_som.pd
@@ -1,62 +1,83 @@
-#N canvas 50 -127 640 687 10;
-#X msg 131 495 print;
-#X msg 132 528 new 5 8 8;
-#X msg 127 99 init;
-#X msg 128 274 train;
-#X msg 129 296 test;
-#X msg 128 387 write;
-#X obj 70 559 ann_som 4 9 10;
+#N canvas 258 163 640 725 10;
+#X msg 131 535 print;
+#X msg 132 568 new 5 8 8;
+#X msg 127 139 init;
+#X msg 128 314 train;
+#X msg 129 336 test;
+#X msg 128 427 write;
+#X obj 70 599 ann_som 4 9 10;
#X msg 70 49 1 0 0 1;
#X msg 70 68 0 1 0 1;
#X msg 70 87 2 1 0 0;
-#X msg 128 118 init 0.5;
-#X msg 128 138 init 1 0.5 0 0.5;
-#X text 234 101 init all weights with "0";
-#X text 235 120 init all weights with "0.5";
-#X text 235 137 init weights for each sensor;
-#X msg 128 163 learn 1;
-#X msg 128 197 learn 1 0.9 0.1;
-#X text 226 163 set learning rate to 1;
-#X msg 128 180 learn 0.5 0.999;
-#X text 227 179 set learning rate to 0.5 and factor to 0.999;
-#X text 227 197 set learning rate to 1 \, factor to 0.9 and offset to 0.1;
-#X msg 128 214 neighbour 1;
-#X msg 128 231 neighbour 0.5 0.999;
-#X msg 128 248 neighbour 1 0.9 0.1;
-#X text 248 215 set neighbourhood to 1;
-#X text 249 231 set neighbourhoodto 0.5 and factor to 0.999;
-#X text 249 249 set neighbourhood to 1 \, factor to 0.9 and offset to 0.1;
-#X text 180 269 set som to "train" mode (learn from sensor-input and output winning neuron);
-#X text 179 291 set som to "test" mode (output winning neuron for sensor-input \, but do not learn !);
-#X msg 129 328 rule INSTAR;
-#X msg 129 345 rule OUTSTAR;
-#X msg 129 362 rule KOHONEN;
-#X text 218 327 learn with IN-STAR rule;
-#X text 219 345 learn with OUT-STAR rule;
-#X text 219 362 learn with KOHONENrule;
-#X msg 128 405 write mysom.som;
-#X msg 129 429 read;
-#X msg 129 447 read mysom.som;
+#X msg 128 158 init 0.5;
+#X msg 128 178 init 1 0.5 0 0.5;
+#X text 234 141 init all weights with "0";
+#X text 235 160 init all weights with "0.5";
+#X text 235 177 init weights for each sensor;
+#X msg 128 203 learn 1;
+#X msg 128 237 learn 1 0.9 0.1;
+#X text 226 203 set learning rate to 1;
+#X msg 128 220 learn 0.5 0.999;
+#X text 227 219 set learning rate to 0.5 and factor to 0.999;
+#X text 227 237 set learning rate to 1 \, factor to 0.9 and offset
+to 0.1;
+#X msg 128 254 neighbour 1;
+#X msg 128 271 neighbour 0.5 0.999;
+#X msg 128 288 neighbour 1 0.9 0.1;
+#X text 248 255 set neighbourhood to 1;
+#X text 249 271 set neighbourhoodto 0.5 and factor to 0.999;
+#X text 249 289 set neighbourhood to 1 \, factor to 0.9 and offset
+to 0.1;
+#X text 180 309 set som to "train" mode (learn from sensor-input and
+output winning neuron);
+#X text 179 331 set som to "test" mode (output winning neuron for sensor-input
+\, but do not learn !);
+#X msg 129 368 rule INSTAR;
+#X msg 129 385 rule OUTSTAR;
+#X msg 129 402 rule KOHONEN;
+#X text 218 367 learn with IN-STAR rule;
+#X text 219 385 learn with OUT-STAR rule;
+#X text 219 402 learn with KOHONENrule;
+#X msg 128 445 write mysom.som;
+#X msg 129 469 read;
+#X msg 129 487 read mysom.som;
#X text 156 68 present various data to the SOM;
-#X text 203 495 for debugging;
-#X text 207 530 create a new SOM with 8x8 neurons \, each having 5 sensors;
-#X text 204 561 create a new SOM with 9x10 neurons \, each having 4 sensors;
-#X floatatom 70 614 4 0 0;
-#X text 113 618 winning neuron;
+#X text 203 535 for debugging;
+#X text 207 570 create a new SOM with 8x8 neurons \, each having 5
+sensors;
+#X text 204 601 create a new SOM with 9x10 neurons \, each having 4
+sensors;
+#X floatatom 70 654 4 0 0 0 - - -;
+#X text 113 658 winning neuron;
#N canvas 13 0 889 630 SOMs 0;
#X text 76 27 SOM :: Self-Organized Maps;
-#X text 55 53 SOMs are "Artificial Neural Networks" \, that are trying to learn something about the data presented to them without a supervisor/teacher.;
+#X text 55 53 SOMs are "Artificial Neural Networks" \, that are trying
+to learn something about the data presented to them without a supervisor/teacher.
+;
#X text 59 118 in short:;
-#X text 120 119 the neuron \, whose weight-configuration matches the presented data best is the winner (its number (counting from the lower-left corner) is sent to the output);
-#X text 121 163 to match the data better the next time it is presented \, the weights of the winning neuron are adjusted.;
-#X text 121 188 the weights of the neurons neighbouring the winner are adjusted to match the data too \, but not so strong as the winner's.;
+#X text 120 119 the neuron \, whose weight-configuration matches the
+presented data best is the winner (its number (counting from the lower-left
+corner) is sent to the output);
+#X text 121 163 to match the data better the next time it is presented
+\, the weights of the winning neuron are adjusted.;
+#X text 121 188 the weights of the neurons neighbouring the winner
+are adjusted to match the data too \, but not so strong as the winner's.
+;
#X text 121 276 lr(n+1)=lr(n)*factor;
#X text 275 277 learning_rate=lr+offset;
#X text 121 289 nb(n+1)=nb(n)*factor;
#X text 275 290 neighbourhood=nb+offset;
-#X text 121 230 both neighbourhood and learning-rate (==amount of how much the weights of the winner (and \, proportional \, the weights of the neighbours) are adjusted) are decreasing recursively with time.;
-#X text 119 319 thus you will sooner or (most of the time) later get a "brain map" \, where similar inputs will activate neurons in specifique regions (like there are regions for seeing and regions for hearing in our brains);
-#X text 97 381 there are various rules \, how to re-adjust the weights of the neurons : in-star \, out-star and kohonen (maybe there are others \, but these i found in literature);
+#X text 121 230 both neighbourhood and learning-rate (==amount of how
+much the weights of the winner (and \, proportional \, the weights
+of the neighbours) are adjusted) are decreasing recursively with time.
+;
+#X text 119 319 thus you will sooner or (most of the time) later get
+a "brain map" \, where similar inputs will activate neurons in specifique
+regions (like there are regions for seeing and regions for hearing
+in our brains);
+#X text 97 381 there are various rules \, how to re-adjust the weights
+of the neurons : in-star \, out-star and kohonen (maybe there are others
+\, but these i found in literature);
#X obj 607 220 +;
#X text 640 182 ...;
#X obj 579 185 * \$1;
@@ -71,10 +92,15 @@
#X text 566 307 the neuron with the highest weighted sum;
#X text 567 318 matches best and is therefore the winner;
#X text 53 452 notes:;
-#X text 101 453 each neuron of the SOM has n sensors. you have to present a list of n floats to the SOM to make it work;
-#X text 102 482 you should init the weights for each sensor with the expected mean of the sensor values before you start training to get best and fastest results;
-#X text 55 87 they were first proposed by the Finnish scientist T.Kohonen in the 80ies (i think).;
-#X text 98 543 if you have no clue \, what's this all about \, maybe you do not need SOMs (which i doubt) or you should have a look at;
+#X text 101 453 each neuron of the SOM has n sensors. you have to present
+a list of n floats to the SOM to make it work;
+#X text 102 482 you should init the weights for each sensor with the
+expected mean of the sensor values before you start training to get
+best and fastest results;
+#X text 55 87 they were first proposed by the Finnish scientist T.Kohonen
+in the 80ies (i think).;
+#X text 98 543 if you have no clue \, what's this all about \, maybe
+you do not need SOMs (which i doubt) or you should have a look at;
#X text 118 577 http://www.eas.asu.edu/~eee511;
#X text 118 591 http://www.cis.hut.fi/projects/ica;
#X connect 13 0 22 0;
@@ -87,8 +113,11 @@
#X connect 21 0 18 0;
#X restore 535 44 pd SOMs;
#X text 81 13 ann_som :: train and test Self-Organized Maps;
-#X obj 73 660 ann_som test.som;
-#X text 211 664 load a SOM-file;
+#X obj 73 700 ann_som test.som;
+#X text 211 704 load a SOM-file;
+#X msg 128 119 rinit 10;
+#X text 234 121 init all weights with time-seeded random values from
+0 to 10;
#X connect 0 0 6 0;
#X connect 1 0 6 0;
#X connect 2 0 6 0;
@@ -112,3 +141,4 @@
#X connect 35 0 6 0;
#X connect 36 0 6 0;
#X connect 37 0 6 0;
+#X connect 48 0 6 0;