GROUPS
Layers
Groups are the mechanism of the NICO toolkit
to handle the structure of the networks. In it's simplest form, a group
has the same function as a so called layer, but a group is really a much
more powerful object than a layer. The following example creates a group
with 7 unnamed units:
AddGroup my_layer my_net.rtdnn
AddUnit -u7 my_layer my_net.rtdnn
Groups can have sub-groups as in this example:
AddGroup SuperGroup my_net.rtdnn
AddGroup SubGroup1 my_net.rtdnn
AddGroup SubGroup2 my_net.rtdnn
Move SubGroup1 SuperGroup my_net.rtdnn
Move SubGroup2 SuperGroup my_net.rtdnn
Here we used the command Move to make the
subgroups members of the supergroup. When a group (or any other object)
is created, it becomes a member of the root group "network", but the following
commands can be used to control the object hierarcy of the network:
Move, Copy, Join, UnJoin, Import
And the following two commands removes and
renames objects:
When referring to a sub-object in a network,
a c-like "dot-syntax" is used. For examle, the following command:
Display -o SuperGroup.SubGroup1 my_net.rtdnn
will output a description of the sub-group
of "SuperGroup" even if there exists another object with the same name
on the top-level. Unnamed objects can also be referred to by using the
"#"-character. For example:
Display my_layer#5 my_net.rtdnn
will output a description
of the 5th object (for example an unnamed unit) of "my_layer".
Modularity
The hirarchical structure of groups makes
it easy to craete modular networks. Here is an example where we make a
small 3-layer network and encapsulate it in a super-group.
AddGroup input my_net.rtdnn
AddUnit -u5 input my_net.rtdnn
AddGroup hidden my_net.rtdnn
AddUnit -u10 hidden my_net.rtdnn
AddGroup output my_net.rtdnn
AddUnit -u3 output my_net.rtdnn
Connect input hidden my_net.rtdnn
Connect hidden output my_net.rtdnn
AddGroup 3-layers my_net.rtdnn
Move input 3-layers my_net.rtdnn
Move hidden 3-layers my_net.rtdnn
Move output 3-layers my_net.rtdnn
We now have a module that can perform some
small task in a bigger network. But to use it we need to connect units
outside the module to the input-layer and also connect the output-layer
to outside units for further processing. In a truly modular approach we
don't want to specify which is the input and output units when we create
these connections. Therefore groups have a property called protection.
Groups protected against output connections are "receptor" groups and groups
protected against input connections are "signal" groups. Groups can also
be protected against all connections -- "hidden" groups -- but the default
is "public", i.e., no protection. We can extend the previous examle with:
Protect -R 3-layers.input my_net.rtdnn
Protect -P 3-layers.hidden my_net.rtdnn
Protect -S 3-layers.output my_net.rtdnn
Here we used the command Protect with the
options -R, -P and -S for receptor, hidden and signal-group respectively.
Now, if we should connect from some outside group:
Connect SomeGroup 3-layers my_net.rtdnn
only connections to the input group are created,
and similarly:
Connect 3-layers SomeOtherGroup my_net.rtdnn
creates only connections from the output group.