NEAL Three-way association function (NEAL3Way)

class nmcog.spinnaker.associate.neal3way.NEAL3Way(bases, associate, turnon='all', twotest=None)

Neuromorphic Embodied Agents that Learn (NEAL) based three-way association function.

Example

bases = {"units": ["animal", "mammal", "bird", "canary"],
         "is-a": [ ["canary", "bird"], ["bird", "animal"], ["mammal", "animal"] ]}
associate = {"properties": ["food", "fur", "flying", "yellow"], # properties to be associated between base units and its relations
             "relations": ["eats", "likes", "travels", "has", "colored"], # relations associated with properties and base units
             "connections": [ ["animal", "eats", "food"], ["mammal", "has", "fur"], # specific combos of base-props-relations
                              ["bird", "travels", "flying"], ["canary", "colored", "yellow"]] }

Note:

  • One may think of the arguments, bases and associate as some a priori knowledge of the embodied agent.
  • The value for “is-a” must have at least one non-empty list.
  • The result of above restriction is that bases must have at least two units, i.e. list of the value for “units” have at least two elements.
  • Usually, the number of “properties” equal the number of base units.
  • The number of “relations” can be of any number as long as there is at least one.
  • Finally, the components within “connections” is of the form [<base-unit>, <a-relation>, <a-property>].
  • Looking from the context of a sentence one may view bases as the subject, “properties” (key of associate) as the object and “relations” (also key of associate) as the predicate, and “connections” as the sentence structure.
  • Specifically the instance of InheritanceReaderClass is the base data for NEAL Three-way association function (NEAL3Way).

Considering the above example whose base data is the instance such that,

>>> print(basedata.units)
["animal", "mammal", "bird", "canary"]

Since there are four association units in the base data, four cell assemblies will be created.

     CA for animal            CA for mammal              CA for bird              CA for canary
ooooooooooooooooooooooo   ooooooooooooooooooooooo   ooooooooooooooooooooooo   ooooooooooooooooooooooo
o                     o   o                     o   o                     o   o                     o
o (0) (2) (4) (6) (8) o   o (0) (2) (4) (6) (8) o   o (0) (2) (4) (6) (8) o   o (0) (2) (4) (6) (8) o
o                     o   o                     o   o                     o   o                     o
o (1) (3) (5) (7) (9) o   o (1) (3) (5) (7) (9) o   o (1) (3) (5) (7) (9) o   o (1) (3) (5) (7) (9) o
o                     o   o                     o   o                     o   o                     o
ooooooooooooooooooooooo   ooooooooooooooooooooooo   ooooooooooooooooooooooo   ooooooooooooooooooooooo

Connection (excitatory) between the cell assemblies is based on the “isA” relationship pair.

>>> print(basedata.isARelationships)
[ ["canary", "bird"], ["bird", "animal"], ["mammal", "animal"] ]

Therefore a hierarchy topology will be created

     ;;;;;;;;;;;;;;;;;;;;;;;;;;              ;;;;;;;;;;;;;;;;;;;;;;;;;;
     ;;;;;;;;;;;;;;;;;;;;;;;;;;              ;;;;;;;;;;;;;;;;;;;;;;;;;;
   ..;;;;;..              ;;;;;            ..;;;;;..              ;;;;;
     ':::'                ;;;;;              ':::'                ;;;;;
      ':'                 ;;;;;               ':'                 ;;;;;
ooooooooooooooooo   ooooooooooooooooo   ooooooooooooooooo   ooooooooooooooooo
o               o   o               o   o               o   o               o
o CA for animal o   o CA for mammal o   o  CA for bird  o   o CA for canary o
o               o   o               o   o               o   o               o
ooooooooooooooooo   ooooooooooooooooo   ooooooooooooooooo   ooooooooooooooooo
       .                                     ;;;;;
     .:;:.                                   ;;;;;
   .:;;;;;:.                                 ;;;;;
     ;;;;;                                   ;;;;;
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

This hierarchy topology is also refered to a the network of the association units in the base data.

  • Refer to NeuralInheritanceClass .makeHiersFromHier for how the excitatory connections among the assembly of association units are made.

Since,

>>> print(propdata.units)
["food", "fur", "flying", "yellow"]

>>> print(reldata.units)
["eats", "likes", "travels", "has", "colored"]

The association topology is

oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo
o                o   o                o   o                o   o                o
o  CA for food   o   o   CA for fur   o   o CA for flying  o   o CA for yellow  o
o                o   o                o   o                o   o                o
oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo

oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo
o                o   o                o   o                o   o                o   o                o
o  CA for eats   o   o  CA for likes  o   o CA for travels o   o   CA for has   o   o CA for colored o
o                o   o                o   o                o   o                o   o                o
oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo

Given an association tuple (list of three strings representing base, relation, and property),

>>> print(assocdata.assocs)
[ ["animal", "eats", "food"], ["mammal", "has", "fur"], ["bird", "travels", "flying"], ["canary", "colored", "yellow"] ]
  • The hierarchy topology to the cell assemblies for property.
  • The hierarchy topology to the cell assemblies for relation.
  • The cell assemblies for property to the hierarchy topology.
  • The cell assemblies for property to the cell assemblies for relation.
  • The cell assemblies for relation to the hierarchy topology.
  • The cell assemblies for relation to the cell assemblies for property.

For illustration below shows only for [ [“animal”, “eats”, “food”], [“canary”, “colored”, “yellow”] ]

                   ;;;;;;;;;;;;;;;;;;;;;;                   ;;;;;;;;;;;;;;;;;;;;;;
                   \/                  ;;                   \/                  ;;
       .    ooooooooooooooooo   ooooooooooooooooo   ooooooooooooooooo   ooooooooooooooooo    .
.......;;.  o               o   o               o   o               o   o               o  .;;..............
;;;::::;;;;.o CA for animal o   o CA for mammal o   o  CA for bird  o   o CA for canary o.;;;;:::::::::::;;;
;;;::::;;:' o               o   o               o   o               o   o               o ':;;:::::::::::;;;
;;;    :'   ooooooooooooooooo   ooooooooooooooooo   ooooooooooooooooo   ooooooooooooooooo   ':           ;;;
;;;                /\                                       ;;                                           ;;;
;;;                ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;                                           ;;;
;;;                                                                                                      ;;;
;;;    .    oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo    .       ;;;
;;;....;;.  o                o   o                o   o                o   o                o  .;;.......;;;
;;;::::;;;;.o  CA for food   o   o   CA for fur   o   o CA for flying  o   o CA for yellow  o.;;;;:::::::;;;
;;;::::;;:' o                o   o                o   o                o   o                o ':;;::::::;;;;;
;;;    :'   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   ':     ':::::'
;;;                                                                                                      ':'
;;;    .    oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo
;;;....;;.  o                o   o                o   o                o   o                o   o                o
;;;::::;;;;.o  CA for eats   o   o  CA for likes  o   o CA for travels o   o   CA for has   o   o CA for colored o
;;;::::;;:' o                o   o                o   o                o   o                o   o                o
       :'   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo   oooooooooooooooooo
get_results()

Returns a dictionary with keys “base”, “property”, and “relation” whose values are dictionaries. A value dictionary is such that the keys are the names of the cell assemblies (i.e. “units” in respective structured data) and values are the respective spike trains (i.e. from all cell units in an assembly).

plot_all(form='1')

Plotting spike trains from all the units within every cell assembly can be done in two ways.

Default

Plots all the spike trains in one plot.

``form = “2”``

Plot of three subplots such that each subplot (invoking __subplot_all()) is the matplotlib’s eventplot of SpikeTrain such that

subplot spike trains for all cell units in all cell assemblies for color map for turnon = "all"
top subject (a.k.a base in basedata) Reds
middle object (a.k.a property in propdata) Blues
bottom predicate (a.k.a relation in reldata) Greens
plot_specific(basename=None, relname=None, propname=None)

Plot of three subplots such that each is the matplotlib’s eventplot of SpikeTrain of all the cell units in cell assembly for given

  • basename in top subplot for subject, color is red
  • relname in middle subplot for predicate, color is green
  • propname in bottom subplot for object, color is blue