Merge /pub/main
[educational.data.git] / AI01 / rbp / poetry.bp
blobbf671a81a1c9cddc2f5342b7f10035768bdff0e7
1 * In this problem a recurrent network is used to memorize two lines of\r
2 * poetry and in effect form a linked list.  It comes from William\r
3 * James' book, _Psychology_ in the chapter on Assoication.  There are\r
4 * two lines of poetry from a poem called Locksley Hall that need to be\r
5 *  memorized:\r
6 *\r
7 *   I the heir of all the ages in the foremost files of time\r
8 *\r
9 *   For I doubt not through all the ages ones increasing purpose runs\r
10 *\r
11 * The problem here is that there are two instances of "the ages" in\r
12 * these two lines.  How does a person manage to keep on track in each\r
13 * instance and produce different output after each "the ages"?\r
14 * Obviously its all the words preceeding "the ages" plus "the ages" that\r
15 * contribute associations.  Its easy to devise a recurrent backprop\r
16 * network to do this.  For simplicity, I changed the lines to:\r
17 *\r
18 *   i the heir of all the ages in the frmst files of\r
19 *\r
20 *   time for i doubt not thru the ages one incre purpo runs\r
21 *\r
22 * so every word is shortened to 5 characters.  Then I converted each\r
23 * letter to its ASCII code and drop the first 3 bits.  In training you\r
24 * input "i" and this is supposed to produce "the" on the output.  Then\r
25 * when you input "the" this should give "heir" on the output units and\r
26 * so on.  When the network memorizes the data it too has to keep a\r
27 * short-term memory of what comes before "the ages" so it can output the\r
28 * right words after each "the ages".\r
29 *\r
30 m 25+20 20 25\r
31 a as dd uq\r
32 qp e 0.025\r
33 s99\r
34 ci 0.5\r
35 f ic oc\r
36 t 0.2\r
37 *e 0.25\r
38 e 0.5 0.05\r
39 a 0\r
40 rt {\r
41 X                         * (nothing) -> i\r
42 0100100000000000000000000\r
43 0100100000000000000000000 H  * i -> the\r
44 1010001000001010000000000\r
45 1010001000001010000000000 H  * the -> heir\r
46 0100000101010011001000000\r
47 0100000101010011001000000 H  * heir -> of\r
48 0111100110000000000000000\r
49 0111100110000000000000000 H  * of -> all\r
50 0000101100011000000000000\r
51 0000101100011000000000000 H  * all -> the\r
52 1010001000001010000000000\r
53 1010001000001010000000000 H  * the -> ages\r
54 0000100111001011001100000\r
55 0000100111001011001100000 H  * ages -> in\r
56 0100101110000000000000000\r
57 0100101110000000000000000 H  * in -> the\r
58 1010001000001010000000000\r
59 1010001000001010000000000 H  * the -> frmst\r
60 0011010010011011001110100\r
61 0011010010011011001110100 H  * frmst -> files\r
62 0011001001011000010110011\r
63 0011001001011000010110011 H  * files -> of\r
64 0111100110000000000000000\r
65 0111100110000000000000000 H  * of -> time\r
66 1010001001011010010100000\r
67 1010001001011010010100000 H  * time -> for\r
68 0011001111100100000000000\r
69 0011001111100100000000000 H  * for -> i\r
70 0100100000000000000000000\r
71 0100100000000000000000000 H  * i -> doubt\r
72 0010001111101010001010100\r
73 0010001111101010001010100 H  * doubt -> not\r
74 0111001111101000000000000\r
75 0111001111101000000000000 H  * not -> thru\r
76 1010001000100101010100000\r
77 1010001000100101010100000 H  * thru -> the\r
78 1010001000001010000000000\r
79 1010001000001010000000000 H  * the -> ages\r
80 0000100111001011001100000\r
81 0000100111001011001100000 H  * ages -> one\r
82 0111101110001010000000000\r
83 0111101110001010000000000 H  * one -> incre\r
84 0100101110000111001000101\r
85 0100101110000111001000101 H  * incre -> purpo\r
86 1000010101100101000001111\r
87 1000010101100101000001111 H  * purpo -> runs\r
88 1001010101011101001100000\r
89 }\r