An EpisodicMemoryMechanism is an IntegratorMechanism that can store and retrieve content-associate pairs.
Only the content is used for determining which pairs are retrieved
Creating a TransferMechanism
An EpisodicMemoryMechanism is created by calling its constructor with content_size and, optionally, assoc_size,
that define the shapes of the items stored in its memory.
An EpisodicMemoryMechanism has at least one InputStates, its CONTENT_INPUT and,
optionally, an ASSOC_INPUT InputState (if its assoc_size is specified and is not 0) that represent
an item to store; a
function that stores and retrieves content-assoc pairs from its
memory; and at least one OutputStates, CONTENT_OUTPUT, as well as a 2nd, CONTENT_OUTPUT if it has
an ASSOC_INPUT InputState, that represent a retrieved item. The default function is a
implements a simple form of content-addressable memory, but a custom function can be specified, so long as it meets the
- It must accept a 2d array as its first argument, the first item of which is the content and the second the associate.
- It must return a 2d array, the first item of which is the retrieved content and the second of which is the
assoc with which it is associated in the
* It may also implement a memory attribute; if it does, it can be accessed by the EpisodicMemoryMechanism’s
When an EpisodicMemoryMechanism is executed, its
function carries out
the following operations:
- retrieves an item from its memory based on the
value of its CONTENT_INPUT InputState;
if no retrieval is made, appropriately shaped zero-valued arrays are assigned to the
value of the CONTENT_OUTPUT and, if specified, it ASSOC_OUTPUT OutputStates.
- stores the
value of its CONTENT_INPUT and, if specified, ASSOC_INPUT `InputStates
<InputState>` in its memory.
* assigns the value of the retrieved item’s content in the EpisodicMemoryMechanism’s CONTENT_OUTPUT
OutputState, and the value of the assoc of the retrieved item in the ASSOC_OUTPUT OutputState.
The order of storage and retieval is determined by the function.
The value of the content of the item retrieved from memory (and stored in CONTENT_OUTPUT) may be different than the
value of CONTENT used to retrieve the item.
If no retrieval is made, appropriately shaped zero-valued arrays are assigned as the
value of the CONTENT_OUTPUT and, if specified, ASSOC_OUTPUT OutputStates.
EpisodicMemoryMechanism(content_size=1, assoc_size=1, function=ContentAddressableMemory, params=None, name=None, prefs=None)
Subclass of IntegratorMechanism that implements a `differentiable neural dictionary
- content_size (int : default 1) – specifies length of the content stored in the
- assoc_size (int : default 0) – specifies length of the assoc stored in the
if it is 0 (the default) then no ASSOC_INPUT InputState or ASSOC_OUTPUT OutputState are created.
- function (function : default ContentAddressableMemory) – 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 content and the second
the associate to be stored in its memory, and must return a 2d array that is the value of the
content and assoc retrieved from its 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
- 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 that implements storage and retrieval from a memory.
3d array – contains key-value pairs stored in the
function <EpisodicMemoryMechanism.function>'s `memory attribute
(if it has one).
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).
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).
Return function’s memory attribute