This program implements the basic functionality of large actor and can be used as a reference program to experiment with that functionality or change it. The program creates a multinode model, in which every node holds a control transfer tree. Those trees might correspond to dendrites of neurons. To every tree leaf an output signal of model node biuniquely corresponds. A tree provides fast selection of an output signal by a model node when the number of those signals is large.
At the beginning of its execution, the program assigns random probabilities to output signals of all model nodes. During the execution of the model, its nodes are activated equiprobably. When a model node is activated, the root of the corresponding tree receives control, and the control is transferred to one of leaves of the tree. When control reaches a leaf of the tree, an output signal is emitted, and increment of spur equal to the logarithm of a probability assigned to the output signal (at the beginning of program execution) is made. Each model node has to learn the correlation between emitting its various output signals and overall change in the spur accumulated by the multinode model and emit more frequently output signals to which greater probabilities correspond.
The program dynamically creates n-ary trees of arbitrary height specified by a program argument.
This is done via generation of text of an assembler program, which contains macro definitions that correspond to tree tiers.
The assembler program does not contain
stt instructions because the multinode model is created with a restriction that an action emission matrix of its every node must specify deterministic choice of actions for all node states.
The assembler program defines a sparse probability profile, which provides quick execution of the assembler program when the tree is large.
For each model node, an n-ary tree of the same structure is used. The tree of model node 0 is created by loading an assembler program into that model node. Trees of all other model nodes are created by cloning a probability profile from model node 0 to them.
Every output signal of model node has a distinct address assigned to it. At every edge of the tree there is located an assembler instruction that appends a number to the address of an output signal. The number is in the range 0 to tree arity minus 1. Before transferring control to the root of the tree, the sequence of numbers of the address is cleared. After transferring control to a leaf of the tree, the sequence of numbers represents the address of an output signal that should be emitted by the model node.
N-ary trees used by the example program have a regular structure. When output signals have nonequal profile probabilities, to select those signals Huffman trees can be used instead. The use of Huffman trees provides that more probable output signals are chosen more quickly. Large actors, the basic functionality of which is implemented by this example program, support building Huffman trees for specific lists of profile probabilities.
The multinode model uses a relative probability function of type
QSMM_RELPROB_BUILTIN2 and three spur types.
Spur type 0 corresponds to the automatic spur of the environment state identification engine.
Spur type 1 corresponds to the auxiliary automatic spur which is incremented at the time of emitting an output signal by the model node.
The increment of the spur of type 1 is equal to the logarithm of the ratio of the number of times the output signal was emitted to the total number of activations of model nodes.
Spur types 0 and 1 have weights 0.5, the normal way of perception, and countervail spur type 2, which has weight 1 and the inverse way of perception.
The increment of the spur of type 2 is performed at the time of emitting an output signal by the model node and is equal to the logarithm of a probability assigned to the output signal at the beginning of execution of the example program.
You should invoke the example program with two arguments. The first argument, a positive integer, specifies the number of model nodes, each corresponding to an n-ary tree. The second argument, an integer greater than 2, specifies tree height. A root node is included in that height, so height 3 specifies a tree with a root node, an intermediate tier, and a tier with tree leaves.
The program understands the following command-line options.
The arity of tree nodes. Default value is 2. In the description of test modes is denoted by ‘Tree arity’.
The maximum fill ratio for vectors that hold relative probabilities of output signals choice, on the basis of which the environment state identification engine decides when to use sparse vectors instead of ordinary vectors. Must be a number in the range 0 to 1 (inclusive). Value 0 means that ordinary vectors must always be used. Value 1 means that sparse vectors must always be used. This option can be helpful in comparing the speed of program operation when sparse vectors are used and when ordinary vectors are used to receive evidence that for tall binary trees the program operates many times faster when sparse vectors are used. Default value is 1.
A seed to initialize the pseudorandom number generator. Default value is 0. In the description of test modes is denoted by ‘Random seed’.
The temperature (multiplied by some constant) of the environment state identification engine. Default value is 1. In the description of test modes is denoted by ‘K*temp. env.’.
The number of activations of model nodes during each test pass. After every activation of a model node an output signal is emitted by the model node. Default value is 10000. In the description of test modes is denoted by ‘Steps per pass’.
A file to write program output to instead of stdout.
Perform the test specified number of passes. In the description of test modes is denoted by ‘Passes’.
The program can be invoked in two modes. In the first mode, when the option -t INT is not given to the program, a single test pass is performed, probabilities of emitting output signals and numbers indicating operating optimality are printed as a result of program invocation. In the second mode, when the option -t INT is given to the program, a specified number of test passes is performed, and numbers that indicate operating optimality are calculated for each test pass. In both modes, the program prints the following numbers related to operating optimality.
Is equal to the logarithm of the product of probabilities of output signals emitted. Each time an output signal is emitted the product of probabilities is multiplied by a corresponding output signal probability, which was randomly generated at the beginning of program execution.
Is the logarithm of the product of probabilities of output signals (see a description of ‘earned’ number) calculated for the situation when all output signals of model node are emitted equal number of times.
Is the logarithm of the product of probabilities of output signals (see a description of ‘earned’ number) calculated for the situation when for every model node an output signal with maximum probability is always emitted.
The sum of Euclidean distances between pairs of vectors for all model nodes, where the first vector of pair is the vector of probabilities of output signals randomly generated at the beginning of program execution, and the second vector of pair is the vector of probabilities of output signals calculated on the basis of actual numbers of times those signals were emitted by a model node during the execution of the model.
Efficiency equal to (earned-random)/(maximal-random)*100%.
Efficiency equal to (1-distance/(nsigIn·√2))*100%, where nsigIn is the number of model nodes.
To perform a single test pass, do not give the option -t INT to the program. In this case, the program output begins with a description of test modes used. After the description there goes a table, where each row represents a model node and starts with its index followed by number pairs that correspond to output signals. The first element of every pair is an output signal probability randomly generated at the beginning of program execution. According to that probability a spur increment is made when the corresponding output signal is emitted by the model node. The second element of every pair is the percentage of output signals emitted by the model node during program execution. The sum of percentages in each row of the table is ≈100%. Numbers that indicate operating optimality are printed after the table.
To perform a test consisting of test passes, give the option -t INT to the program and specify the number of test passes as the argument of that option. Below is sample program output for this method of program invocation.
$ ./tohuff-test -i1 -t10 -n160000 5 11 Input signals: 5 Output signals: 1024 Tree arity: 2 Passes: 10 Steps per pass: 160000 K*temp. env.: 1.000000000000000E+00 Random seed: 1 pass earned random maximal distance % ef1 % ef2 ---- -------- -------- -------- -------------- ------- ------- 1 -1060590 -1158415 -999031 3.57817309E+00 61.4 49.4 2 -1076420 -1155144 -1000943 3.72134950E+00 51.1 47.4 3 -1076429 -1158869 -997977 4.38714574E+00 51.2 38.0 4 -1088714 -1157306 -998875 4.24814120E+00 43.3 39.9 5 -1046098 -1158339 -1000010 4.46812225E+00 70.9 36.8 6 -1053158 -1158577 -996437 4.27544598E+00 65.0 39.5 7 -1088164 -1158800 -998089 3.27629262E+00 44.0 53.7 8 -1068321 -1158087 -997921 4.29218964E+00 56.0 39.3 9 -1089652 -1157490 -998018 2.46268987E+00 42.5 65.2 10 -1068592 -1158506 -996874 4.08599981E+00 55.6 42.2 TOTL -10716138 -11579534 -9984177 3.87955497E+01 54.1 45.1 stddev ef1: 9.6 stddev ef2: 8.9
The output begins with a description of test modes used. In the description of test modes, ‘Input signals’ denotes the number of model nodes. After the description there goes a table containing numbers that indicate operating optimality of the multinode model at every test pass, with a summary row. Values ‘earned’, ‘random’, ‘maximal’, and ‘distance’ in the summary row are equal to sums of those values in preceding rows of the table. Values ‘% ef1’ and ‘% ef2’ in the summary row are calculated based on other values in that row. At the end of the output the standard deviation of values ‘% ef1’ and ‘% ef2’ is printed.
Reference results of program invocation are represented below. Values of ‘% ef1’ and ‘% ef2’ were taken from summary rows of test logs.
Options nSigOut % ef1 % ef2 ====================== ======= ===== ===== -i1 -t100 -n10000 4 7 64 43.5 76.6 -i1 -t100 -n20000 4 7 64 52.2 69.9 ---------------------- ------- ----- -----
-i1 -t100 -n10000 8 7 64 39.2 67.7 -i1 -t100 -n20000 8 7 64 47.3 59.3 -i1 -t100 -n40000 8 7 64 51.3 51.4 ---------------------- ------- ----- -----
-i1 -t100 -n10000 4 8 128 39.4 75.6 -i1 -t100 -n20000 4 8 128 50.0 67.5 -i1 -t100 -n40000 4 8 128 58.4 58.5 ---------------------- ------- ----- -----
-i1 -t100 -n10000 4 9 256 30.4 80.8 -i1 -t100 -n20000 4 9 256 42.6 70.7 -i1 -t100 -n40000 4 9 256 54.7 59.2 ====================== ======= ===== =====
As it can be seen from the above results, for every pair, which consists of the number of model nodes and tree height, there exists the number of activations of model nodes, which gives the value of ‘% ef1’ greater than 50%.