EpisodicMemoryMechanism

Overview

An EpisodicMemoryMechanism is an IntegratorMechanism that can store and retrieve cue-associate pairs.

Creating a TransferMechanism

An EpisodicMemoryMechanism is created by calling its constructor with cue_size and assoc_size that define the shapes of the items stored in its memory.

Structure

An EpisodicMemoryMechanism has two InputStates, CUE_INPUT and ASSOC_INPUT, that represent an item to store; a function that stores and retrieves cue-assoc pairs from its memory; and two OutputStates, ASSOC_OUTPUT and CUE_OUTPUT that represent a retrieved item. The default function is a DND that implements a simple form of differentiable neural dictionary, but a custom function can be specified, so long as it meets the following requirements:

  • It must accept a 2d array as its first argument, the first item of which is the cue and the second the associate.
  • It must return a 2d array, the first item of which is the retrieved associate and the second of which is the cue with which it is associated in the function’s memory.
  • It may also implement a memory attribute; if it does, it can be accessed by the EpisodicMemoryMechanism’s memory attribute.

Execution

When an EpisodicMemoryMechanism is executed, its function carries out the following operations:

  • retrieves an item from its memory based on the value of its CUE_INPUT InputState; if no retrieval is made, appropriately shaped zero-valued arrays are assigned to the value of the ASSOC_OUTPUT and CUE_OUTPUT OutputStates.
  • assigns the value of the retrieved item’s assoc in the EpisodicMemoryMechanism’s ASSOC_OUTPUT OutputState, and the value of the cue of the retrieved item in the CUE_OUTPUT OutputState.

Note

The order of storage and retieval is determined by the function.

The value of the cue of the item retrieved from memory (and stored in CUE_OUTPUT) may be different than the value of CUE used to retrieve the item.

If no retrieval is made, appropriately shaped zero-valued arrays are assigned as the value of the ASSOC_OUTPUT and CUE_OUTPUT OutputStates.

Class Reference

class psyneulink.library.components.mechanisms.processing.integrator.episodicmemorymechanism.EpisodicMemoryMechanism(cue_size=1, assoc_size=1, function=DND, params=None, name=None, prefs=None)

Subclass of IntegratorMechanism that implements a differentiable neural dictionary (DND)

Parameters:
  • cue_size (int : default 1) – specifies length of the cue stored in the functions memory.
  • assoc_size (int : default 1) – specifies length of the assoc stored in the functions memory.
  • function (function : default DND) – specifies the function that implements a memory store and methods to store to and retrieve from it. It must take as its variable a 2d array, the first item of which is the cue and the second the associate to be stored in its memory, and must return a 2d array that is the value of the retriefved associate and the actual cue associated with it in memory.
  • params (Dict[param keyword: param value] : default None) – a parameter dictionary that can be used to specify the parameters for the Mechanism, its function, and/or a custom function and its parameters. Values specified for parameters in the dictionary override any assigned to those parameters in arguments of the constructor.
  • name (str : default see name) – specifies the name of the EpisodicMemoryMechanism.
  • prefs (PreferenceSet or specification dict : default Mechanism.classPreferences) – specifies the PreferenceSet for the EpisodicMemoryMechanism; see prefs for details.
function

function – function that implements storage and retrieval from a memory.

memory

3d array – contains key-value pairs stored in the function <EpisodicMemoryMechanism.function>'s `memory attribute (if it has one).

name

str – the name of the EpisodicMemoryMechanism; if it is not specified in the name argument of the constructor, a default is assigned by MechanismRegistry (see Naming for conventions used for default and duplicate names).

prefs

PreferenceSet or specification dict – the PreferenceSet for the EpisodicMemoryMechanism; if it is not specified in the prefs argument of the constructor, a default is assigned using classPreferences defined in __init__.py (see PreferenceSet for details).