Examples using nengo.networks.AssociativeMemory


I want to use the AssociativeMemory for autoassociative clean-up memory

In SPA binding and unbinding operations almost always include terms that are nuisance noise.

Other than the associative memory example which I’m sure predates the associative memory object, are there examples using AssociativeMemory for SPA clean-up?


(I’ve been inhibited asking questions that I consider naive, but I decided to ‘go for it’!



Hi @HowardC, no such thing as a bad question!

When you say “associative memory example”, are you referring to this one or the learning associations example? The former uses spa.AssociativeMemory object, and uses that object as a cleanup memory.

To my knowledge, these are the only associative memory examples currently available, but there are many full models that use the associative memory, so if these examples aren’t sufficient, we can probably find a model that does something similar to what you’re looking to do.


Trevor -

Thanks. I discovered the example within 5 minutes of writing to the forum about it. My only suggestion might be to add one or two sentences to the description of the earlier code that would lead to the AM_object itself.

If I need help finding the full models, I’ll let you know.



That’s a good idea, I’ll make a note to add that shortly. Thanks!


Trevor - if you could link me to one or 2 examples of code that uses associative mem module within a larger program, that would be great.




Not sure how helpful this is without further explanation, but this is a model that uses the associative memory.


Thanks everyone -

I don’t understand why the ff. code doesn’t work - output from AM does not seem to be passed to the state module.

import nengo
import nengo.spa as spa

D = 32
model = spa.SPA()
with model:
    model.vocab = spa.Vocabulary(D)
    words = ['ONE', 'TWO', 'THREE', 'FOUR']
    for word in words:
    model.AM = spa.AssociativeMemory(input_vocab = model.vocab, output_vocab = model.vocab, threshold = 0.3)
    model.input_AM = spa.Input(AM = ' 0.45 * ONE')
    model.get_from_AM = spa.State(D)
    nengo.Connection(model.AM.output, model.get_from_AM.input, synapse = 0.03)


Any help would be appreciated?



The second to last line needs to be:

    model.get_from_AM = spa.State(D, vocab=model.vocab)

Otherwise the spa.State will use the D-dimensional default vocabulary which is different from the vocabulary model.vocab that you define explicitly.