I have some queries on SPA associative memory usage.
I am trying to hook up multiple associative memories together, so that for example an output pointer from one memory is sent via a nengo.connection to another memory and transformed into something else via a heteroassociative rule.
This works fine when linking memories 1:1, thanks to the ability to choose input_vocab and output_vocab separately (with input_vocab set to the vocab of the source memory, and output_vocab set to the target memory).
Unfortunately I have not found a similarly simple way to hook up memories in a many-to-one fashion. Say there is Area A and Area B both projecting to Area C, and the heteroassociation rule in Area C looks like the following:
“A.1 + B.1 -> C.1”. To do this, I currently do the following:
- make a new vocab called vocabAB and add to it all key/vectors from A and all key/vectors from B
- set vocabAB as the input_vocab to memory C
Is there a better way to do this?
Likewise as shown above, C’s heteroassociative memory depends on 2 inputs. In the current API, SPA.AssociativeMemory’s input_keys argument cannot be set to ‘A + B’ for example. At present I do it by parsing the key “A + B” as so: normalize(input_vocab.parse(key).v), and then in the Spa.AssociativeMemory initializer’s call to AssocMem I set input_vectors directly instead of parsing input_keys. Is this the right approach?
The above methods I’m using seem to work but they seem like ‘hacks’ so I thought I would ask for some advice.